/* FIGHTCLUP.io — Direction v2 (docs/reference/DIRECTION_V2_2026-11-01.md).
   World = Pixi at device resolution (integer device texture + linear residual). Everything around it is
   DOM in CSS px, sized per viewport bucket S/M/L/XL (html[data-bucket], set by Render.layout()).
   One opaque top bar in every state; one top-anchored centre column; opacity-only state changes;
   nothing scrolls on desktop. Pixel-art UI images scale by integer --ui with image-rendering: pixelated. */
@font-face { font-family: "Jersey 10"; font-style: normal; font-weight: 400; font-display: swap; src: url("/vendor/fonts/jersey10-latin.woff2") format("woff2"); }
@font-face { font-family: "VT323"; font-style: normal; font-weight: 400; font-display: swap; src: url("/vendor/fonts/vt323-latin.woff2") format("woff2"); }

:root {
  --ink: #0b0a10; --coal: #1c1a24; --slate: #3a3744; --steel: #7a7f8e; --ash: #b9b4c2; --bone: #e9e6ea; --white: #ffffff;
  --arena: #160f20; --arena-black: #0e0a14; --bg: var(--arena-black); --panel: #122a4e;
  --self: #e0141c; --self-hi: #ff5a4a; --self-shade: #a80f18; --self-deep: #5e0a12;
  --opp: #2f62d8; --opp-hi: #7fb0ff; --opp-shade: #1d3f98; --opp-deep: #122a4e;
  --canvas: #6a97a0; --canvas-hi: #85aeb5; --canvas-shade: #4a6f78; --canvas-deep: #33505a;
  --warn: #e5e153; --ok: #46d94c; --ok-dim: #2f9438; --gold: #d2ae42; --gold-hi: #ffd84a; --gold-shade: #8a5e22; --blood: #b3121f;
  --font-display: "Jersey 10", "Press Start 2P", monospace; --font-mono: "VT323", "Courier New", monospace;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --dur-fast: 120ms; --dur-med: 240ms; --dur-slow: 400ms;
  --ease-snap: cubic-bezier(0.2, 0.9, 0.3, 1); --ease-slam: cubic-bezier(0.34, 1.56, 0.64, 1); --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  /* scene mapping, set by Render.layout(): CSS px of scene texel (0,0) and CSS px per texel */
  --scene-left: 0px; --scene-top: 0px; --scene-scale: 1;
  /* image URLs (also set by assets.js; these defaults keep CSS valid without the loader) */
  --img-logo: url("/assets/ui/logo.png"); --img-portrait_red: url("/assets/ui/portrait_red.png"); --img-portrait_blue: url("/assets/ui/portrait_blue.png");
  --img-round_card: url("/assets/ui/round_card.png"); --img-kd_digits: url("/assets/ui/kd_digits.png"); --img-rank_badges: url("/assets/ui/rank_badges.png");
  --img-touch_glyphs: url("/assets/ui/touch_glyphs.png"); --img-body_damage: url("/assets/ui/body_damage.png");
  --img-title_ko: url("/assets/ui/title_ko.png"); --img-title_tko: url("/assets/ui/title_tko.png"); --img-title_win: url("/assets/ui/title_win.png"); --img-title_lose: url("/assets/ui/title_lose.png"); --img-title_draw: url("/assets/ui/title_draw.png");
}
/* ---- bucket tokens: S / M / L / XL ---- */
html[data-bucket="S"]  { --hud-h: 56px; --fs-name: 20px; --fs-clock: 28px; --fs-small: 14px; --fs-body: 16px; --fs-h: 20px; --fs-fx: 20px; --fs-fx-big: 26px; --fs-title: 48px; --btn-h: 40px; --fs-btn: 20px; --ui: 1; --bv: 1px;
  --col-w: min(calc(100vw - 32px), 420px); --col-w-res: min(calc(100vw - 16px), 440px); --col-top: 12px; --board-w: 280px; --row-h: 22px;
  --plate-w: 200px; --portrait: 0px; --sil-w: 0px; --sil-h: 0px; --clock-w: 120px; --stam-w: 160px; --stam-h: 12px; --tv: 32px; --tb: 80px; --tl: 96px; --tape-port: 32px; }
html[data-bucket="M"]  { --hud-h: 64px; --fs-name: 24px; --fs-clock: 36px; --fs-small: 16px; --fs-body: 18px; --fs-h: 24px; --fs-fx: 24px; --fs-fx-big: 32px; --fs-title: 64px; --btn-h: 44px; --fs-btn: 20px; --ui: 2; --bv: 2px;
  --col-w: 480px; --col-w-res: 640px; --col-top: 24px; --board-w: 320px; --row-h: 24px;
  --plate-w: 300px; --portrait: 64px; --sil-w: 68px; --sil-h: 48px; --clock-w: 140px; --stam-w: 200px; --stam-h: 14px; --tv: 44px; --tb: 150px; --tl: 140px; --tape-port: 32px; }
html[data-bucket="L"]  { --hud-h: 72px; --fs-name: 30px; --fs-clock: 40px; --fs-small: 18px; --fs-body: 20px; --fs-h: 28px; --fs-fx: 30px; --fs-fx-big: 40px; --fs-title: 80px; --btn-h: 48px; --fs-btn: 24px; --ui: 2; --bv: 2px;
  --col-w: 560px; --col-w-res: 720px; --col-top: 40px; --board-w: 360px; --row-h: 28px;
  --plate-w: 400px; --portrait: 64px; --sil-w: 68px; --sil-h: 48px; --clock-w: 160px; --stam-w: 280px; --stam-h: 14px; --tv: 48px; --tb: 200px; --tl: 160px; --tape-port: 64px; }
html[data-bucket="XL"] { --hud-h: 96px; --fs-name: 40px; --fs-clock: 54px; --fs-small: 24px; --fs-body: 26px; --fs-h: 36px; --fs-fx: 40px; --fs-fx-big: 54px; --fs-title: 108px; --btn-h: 56px; --fs-btn: 30px; --ui: 3; --bv: 3px;
  --col-w: 720px; --col-w-res: 900px; --col-top: 56px; --board-w: 420px; --row-h: 34px;
  --plate-w: 520px; --portrait: 96px; --sil-w: 92px; --sil-h: 72px; --clock-w: 200px; --stam-w: 400px; --stam-h: 18px; --tv: 60px; --tb: 260px; --tl: 200px; --tape-port: 96px; }

/* ---- shell ---- */
* { margin: 0; padding: 0; box-sizing: border-box; border-radius: 0; }
html, body { height: 100dvh; overflow: hidden; }
body { background: var(--bg); color: var(--white); font-family: var(--font-mono); font-size: var(--fs-body); line-height: 1.25; user-select: none; -webkit-user-select: none; touch-action: none; }
#gameContainer { position: fixed; inset: 0; z-index: 0; }
#gameContainer canvas { display: block; }
#app { position: fixed; inset: 0; z-index: 1; display: grid; grid-template-rows: var(--hud-h) 1fr; pointer-events: none; }
#stage { position: relative; overflow: hidden; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.jersey, .pname, .vs-name, .result-title, #centreBig, .sc-title, .q-title, .logo, .board-tabs .tab, .btn, #clock, #queueTime, .rc-word, .rc-num, .fxl, #cards span, .tn { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; line-height: 1; }
img, .px { image-rendering: pixelated; }

/* ---- bevel primitives (CSS px) ---- */
.bevel { box-shadow: inset var(--bv) var(--bv) 0 var(--steel), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--slate), 0 0 0 var(--bv) var(--ink); }
.card { background: var(--arena-black); padding: var(--sp-4); box-shadow: inset var(--bv) var(--bv) 0 var(--slate), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--ink), 0 0 0 var(--bv) var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: var(--btn-h); min-width: 120px; padding: 0 var(--sp-4); font-size: var(--fs-btn); color: var(--white); background: var(--opp); border: 0; pointer-events: auto;
  box-shadow: inset var(--bv) var(--bv) 0 var(--opp-hi), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--opp-shade), 0 0 0 var(--bv) var(--ink); }
.btn:hover { background: var(--opp-hi); }
.btn:active, .btn.pressed { background: var(--opp-shade); box-shadow: inset var(--bv) var(--bv) 0 var(--opp-shade), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--opp-hi), 0 0 0 var(--bv) var(--ink); }
.btn.btn-primary { background: var(--self); box-shadow: inset var(--bv) var(--bv) 0 var(--self-hi), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--self-shade), 0 0 0 var(--bv) var(--ink); }
.btn.btn-primary:hover { background: var(--self-hi); }
.btn.btn-primary:active, .btn.btn-primary.pressed { background: var(--self-shade); box-shadow: inset var(--bv) var(--bv) 0 var(--self-shade), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--self-hi), 0 0 0 var(--bv) var(--ink); }
.btn.btn-tertiary { background: var(--panel); color: var(--ash); box-shadow: inset var(--bv) var(--bv) 0 var(--steel), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--ink), 0 0 0 var(--bv) var(--ink); }
.btn.btn-tertiary:hover { color: var(--white); }
.btn:disabled, .btn.disabled { background: var(--slate); color: var(--steel); cursor: not-allowed; box-shadow: inset var(--bv) var(--bv) 0 var(--steel), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--coal), 0 0 0 var(--bv) var(--ink); }
.btn.voted { background: var(--ok-dim); }

/* ---- layers: opacity-only crossfades, nothing scrolls ---- */
.layer { position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow: hidden; opacity: 0; pointer-events: none; transition: opacity var(--dur-med) var(--ease-out); }
.layer.on { opacity: 1; }
.layer.on .card, .layer.on .board, .layer.on .result-col { pointer-events: auto; }
#hud, #hud * { pointer-events: none; }
.centre-col { position: absolute; top: var(--col-top); left: calc(50% - var(--col-w) / 2); width: var(--col-w); }
.result-col { left: calc(50% - var(--col-w-res) / 2); width: var(--col-w-res); }

/* ---- TOP BAR ---- */
#hudBar { position: relative; display: flex; align-items: center; justify-content: space-between; height: var(--hud-h); background: var(--arena-black); border-bottom: 2px solid var(--coal); pointer-events: none; z-index: 5; }
#hudBar .side { display: flex; align-items: center; gap: var(--sp-1); height: 100%; padding: 0 var(--sp-1); }
#hudBar .portrait { width: var(--portrait); height: var(--portrait); flex: none; }
.portrait { background: var(--img-portrait_red) no-repeat 0 0 / 100% 100%; image-rendering: pixelated; box-shadow: 0 0 0 1px var(--ink); position: relative; }
.portrait.opp { background-image: var(--img-portrait_blue); }
.portrait.empty { background: var(--coal); display: flex; align-items: center; justify-content: center; }
.portrait .q { display: none; font-family: var(--font-display); font-size: var(--fs-name); color: var(--steel); }
.portrait.empty .q { display: block; }
html[data-bucket="S"] #hudBar .portrait, html[data-bucket="S"] #hudBar .sil { display: none; }
/* Two real damage pools: head and torso. Native SVG stays sharp at HUD resolution. */
.sil { width: var(--sil-w); height: var(--sil-h); flex: none; display: grid; grid-template-rows: 1fr 1fr; gap: 4px; }
.sil > i { --damage-color: var(--self-hi); display: flex; align-items: center; gap: 4px; min-width: 0; padding: 1px 3px; background: var(--arena); border: 1px solid var(--slate); font-style: normal; }
.sil .sh { --damage: var(--hp, 0); } .sil .sb { --damage: var(--bp, 0); }
.sil svg { width: 20px; height: 20px; flex: none; overflow: visible; }
.zone-shape { fill: var(--panel); stroke: var(--ash); stroke-width: 1.25; stroke-linejoin: bevel; }
.zone-shape.heat { fill: var(--damage-color); stroke: none; opacity: var(--damage); }
.zone-detail { fill: none; stroke: var(--steel); stroke-width: 1; stroke-linecap: square; }
.zone-readout { display: block; flex: 1; min-width: 0; }
.zone-readout b { display: block; font: 400 14px/1 var(--font-mono); letter-spacing: .06em; color: var(--bone); }
.zone-track { display: block; height: 3px; margin-top: 1px; background: var(--coal); border-bottom: 1px solid var(--slate); }
.zone-track em { display: block; height: 100%; width: calc(var(--damage) * 100%); background: var(--damage-color); transition: width var(--dur-fast) var(--ease-out); }
.sil > i.mid { --damage-color: var(--self); }
.sil > i.crit, .sil.rocked .sh { --damage-color: var(--self); animation: zoneCritical 250ms steps(1) infinite; }
.sil.rocked .sh { --damage: 1; }
.sil > i.hitflash { --damage-color: var(--white) !important; }
.sil > i.hitflash .heat { opacity: 1; }
@keyframes zoneCritical { 50% { --damage-color: var(--white); } }
html[data-bucket="XL"] .sil svg { width: 28px; height: 28px; }
html[data-bucket="XL"] .zone-readout b { font-size: 18px; }
html[data-bucket="XL"] .zone-track { height: 6px; }
/* Keep damage readable in a narrow desktop panel without crowding the clock. */
@media (min-width: 560px) and (max-width: 999px) {
  html[data-bucket="S"] { --sil-w: 56px; --sil-h: 44px; --plate-w: min(200px, calc((100vw - 144px) / 2 - 64px)); --stam-w: calc(var(--plate-w) - 16px); }
  html[data-bucket="S"] #hudBar .sil { display: grid; }
  html[data-bucket="S"] .sil > i { gap: 2px; padding: 1px 2px; }
  html[data-bucket="S"] .sil svg { width: 16px; height: 16px; }
  html[data-bucket="S"] .zone-readout b { font-size: 12px; }
  html[data-bucket="S"] .zone-track { height: 3px; margin-top: 1px; }
  html[data-bucket="S"] .prank { display: none; }
  html[data-bucket="S"] .plate .pname { max-width: calc(var(--plate-w) - 12px); }
}
.plate { position: relative; width: var(--plate-w); height: 100%; flex: none; }
.pname { position: absolute; left: 6px; top: 8px; max-width: calc(var(--plate-w) - 120px); font-size: var(--fs-name); color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--dur-fast); }
.pname.placeholder { color: var(--steel); }
.prank { position: absolute; right: 6px; top: 10px; font-size: var(--fs-small); color: var(--gold); white-space: nowrap; }
.meters { position: absolute; left: 8px; bottom: 4px; width: var(--stam-w); transition: opacity var(--dur-med); }
.meters.off { opacity: 0; }
.stam { height: var(--stam-h); background: var(--ink); padding: 2px; box-shadow: inset 1px 1px 0 var(--slate), 0 0 0 1px var(--ink); }
.stamFill { height: 100%; width: 100%; background: var(--opp-hi); box-shadow: inset 0 1px 0 var(--white); }
.stamFill.warn { background: var(--warn); }
.stamFill.low { background: var(--self); box-shadow: inset 0 1px 0 var(--self-hi); }
.gstrip { height: 4px; margin-top: 2px; background: var(--ink); }
.gFill { height: 100%; width: 100%; background: var(--bone); }
.gFill.broken { background: var(--self); }
.plate.opp .pname { left: auto; right: 6px; }
.plate.opp .prank { right: auto; left: 6px; }
.plate.opp .meters { left: auto; right: 8px; direction: rtl; }
.slide-in { animation: slideIn var(--dur-med) var(--ease-snap); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }
#hudBar > .mid { position: absolute; left: 50%; top: 0; height: 100%; width: 0; display: flex; justify-content: center; }
#clockBox { position: absolute; left: calc(-1 * var(--clock-w) / 2); top: 0; width: var(--clock-w); height: 100%; text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 2px; background: var(--arena); box-shadow: inset 0 0 0 1px var(--coal); }
#roundNo { font-size: var(--fs-small); color: var(--ash); line-height: 1; }
.clockline { font-size: var(--fs-clock); color: var(--white); font-variant-numeric: tabular-nums; }
#clock.urgent { color: var(--self); animation: clockTick 1s steps(1) infinite; }
@keyframes clockTick { 50% { transform: translateY(-1px); } }
#liveLine { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--white); text-transform: none; letter-spacing: 0; }

/* cards strip under the clock */
#cards { position: absolute; left: calc(50% - 120px); top: 4px; width: 240px; height: 24px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; background: rgba(14, 10, 20, 0.85); box-shadow: 0 0 0 1px var(--ink); z-index: 4; }
#cards span { font-size: 20px; }
#cardsSelf { color: var(--self-hi); } #cardsOpp { color: var(--opp-hi); }
#leadBar { position: relative; width: 160px; height: 8px; background: var(--coal); }
#leadBar b { position: absolute; left: 79px; top: 0; width: 2px; height: 8px; background: var(--steel); }
#leadFill { position: absolute; top: 0; height: 8px; width: 0; left: 80px; background: var(--slate); transition: width var(--dur-fast) linear, left var(--dur-fast) linear; }
#leadFill.self { background: var(--self); } #leadFill.opp { background: var(--opp); }
html[data-bucket="S"].is-touch #cards { display: none; }

/* ---- stage tints (below overlays) ---- */
#fxLayer { position: absolute; inset: 0; pointer-events: none; }
#vignette { position: absolute; inset: 0; opacity: 0; background: transparent; box-shadow: inset 0 0 0 4px rgba(94,10,18,0.55); transition: opacity var(--dur-slow); }
#vignette.on { opacity: 1; animation: heartPulse 820ms steps(2, end) infinite; }
@keyframes heartPulse { 50% { opacity: 0.85; } }
#rockedTint { position: absolute; inset: 0; opacity: 0; background: transparent; box-shadow: inset 0 0 0 3px rgba(229,225,83,0.3); }
#rockedTint.on { opacity: 1; animation: rockedWobble 250ms steps(2, end) infinite; }
@keyframes rockedWobble { 50% { opacity: 0.4; } }

/* ---- fight overlays (scene-anchored via --scene-left / --scene-scale; layer top = hud bottom) ---- */
#fxLabels { position: absolute; inset: 0; }
.fxl, .kd { position: absolute; left: 0; top: 0; opacity: 0; white-space: nowrap; }
.fxl { font-size: var(--fs-fx); color: var(--white); text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 3px 0 var(--ink); }
.fxl.big { font-size: var(--fs-fx-big); }
.fxl.on, .kd.on { animation: fxl 600ms linear forwards; }
@keyframes fxl { 0% { opacity: 1; transform: translate(-50%, -100%) scale(1.4); } 20% { transform: translate(-50%, -100%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, calc(-100% - 24px)) scale(1); } }
.kd { width: calc(24px * (var(--ui) + 1)); height: calc(32px * (var(--ui) + 1)); background: var(--img-kd_digits) no-repeat; background-size: calc(240px * (var(--ui) + 1)) 100%; background-position: calc(var(--kd, 0) * -24px * (var(--ui) + 1)) 0; image-rendering: pixelated; }
#countDigit { position: absolute; opacity: 1; left: calc(var(--scene-left) + 320px * var(--scene-scale)); top: calc(var(--scene-top) + 96px * var(--scene-scale)); transform: translate(-50%, -50%); }
#countDigit.pop { animation: pop 180ms var(--ease-slam); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(2); } to { transform: translate(-50%, -50%) scale(1); } }
#banner { position: absolute; left: calc(var(--scene-left) + 320px * var(--scene-scale)); top: calc(var(--scene-top) + 36px * var(--scene-scale)); transform: translateX(-50%); padding: 4px 16px; white-space: nowrap; font-size: var(--fs-h); color: var(--white); background: var(--arena-black); box-shadow: 0 0 0 2px var(--self); animation: bannerIn var(--dur-fast) var(--ease-snap); }
@keyframes bannerIn { from { transform: translate(-50%, -8px); opacity: 0; } }
/* round card: image at --ui + 1, number composited; sub-line chip 8 px under */
#roundCard { position: absolute; left: calc(var(--scene-left) + 320px * var(--scene-scale)); top: calc(var(--scene-top) + 96px * var(--scene-scale)); transform: translate(-50%, -50%); text-align: center; animation: cardDrop 300ms var(--ease-snap); }
#roundCard.out { animation: cardExit 200ms var(--ease-out) forwards; }
@keyframes cardDrop { from { transform: translate(-50%, calc(-50% - 160px)); } }
@keyframes cardExit { to { transform: translate(-50%, calc(-50% - 200px)); opacity: 0; } }
.rc-img { position: relative; width: calc(96px * (var(--ui) + 1)); height: calc(72px * (var(--ui) + 1)); margin: 0 auto; background: var(--img-round_card) no-repeat 0 0 / 100% 100%; image-rendering: pixelated; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rc-word { font-size: calc(8px * (var(--ui) + 1)); color: var(--coal); margin-top: calc(8px * (var(--ui) + 1)); }
.rc-num { font-size: calc(32px * (var(--ui) + 1)); color: var(--coal); }
.rc-sub { display: inline-block; margin-top: 8px; padding: 2px 12px; font-size: var(--fs-h); color: var(--bone); background: var(--arena-black); box-shadow: 0 0 0 1px var(--ink); white-space: nowrap; }

/* ---- tale of the tape during the ring-card walk (scene-anchored, full scene width, above the fighters) ---- */
#fightCards { position: absolute; left: var(--scene-left); top: calc(var(--scene-top) + 6px * var(--scene-scale)); width: calc(640px * var(--scene-scale)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: var(--sp-3); padding: 0 calc(12px * var(--scene-scale)); pointer-events: none; }
.fc { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3); background: var(--arena-black); box-shadow: inset var(--bv) var(--bv) 0 var(--slate), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--ink), 0 0 0 var(--bv) var(--ink); animation: fcInL var(--dur-med) var(--ease-snap); }
.fc.self { border-left: calc(var(--bv) * 3) solid var(--self); }
.fc.opp { flex-direction: row-reverse; text-align: right; border-right: calc(var(--bv) * 3) solid var(--opp); animation-name: fcInR; }
.fc .portrait { width: calc(32px * (var(--ui) + 1)); height: calc(32px * (var(--ui) + 1)); flex: none; }
.fc-body { min-width: 0; flex: 1; }
.fc-name { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; line-height: 1; font-size: var(--fs-h); color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc.self .fc-name { color: var(--self-hi); } .fc.opp .fc-name { color: var(--opp-hi); }
.fc-tier { margin: var(--sp-1) 0 var(--sp-2); font-size: var(--fs-body); color: var(--gold); white-space: nowrap; }
.fc-tier .badge { width: calc(12px * var(--ui)); height: calc(12px * var(--ui)); background-size: calc(72px * var(--ui)) 100%; }
.fc-tier .badge.b1 { background-position: calc(-12px * var(--ui)) 0; } .fc-tier .badge.b2 { background-position: calc(-24px * var(--ui)) 0; } .fc-tier .badge.b3 { background-position: calc(-36px * var(--ui)) 0; } .fc-tier .badge.b4 { background-position: calc(-48px * var(--ui)) 0; } .fc-tier .badge.b5 { background-position: calc(-60px * var(--ui)) 0; }
.fc-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-body); line-height: 1.3; white-space: nowrap; }
.fc.opp .fc-row { flex-direction: row-reverse; }
.fc-row span { color: var(--ash); } .fc-row b { color: var(--white); font-weight: normal; font-variant-numeric: tabular-nums; }
.fc-row.cards b { color: var(--gold-hi); }
.fc-mid { text-align: center; padding-top: var(--sp-2); animation: fcDrop var(--dur-med) var(--ease-snap); }
.fc-round { font-family: var(--font-display); text-transform: uppercase; font-size: var(--fs-h); color: var(--bone); text-shadow: 2px 2px 0 var(--ink); }
.fc-num { font-family: var(--font-display); font-size: var(--fs-title); line-height: 0.9; color: var(--white); text-shadow: 3px 3px 0 var(--self), 5px 5px 0 var(--ink); }
.fc-sub { display: inline-block; margin-top: var(--sp-2); padding: 2px 10px; font-family: var(--font-display); text-transform: uppercase; font-size: var(--fs-small); color: var(--bone); background: var(--arena-black); box-shadow: 0 0 0 1px var(--ink); white-space: nowrap; }
#fightCards.out .fc { animation: fcOutL var(--dur-med) var(--ease-out) forwards; }
#fightCards.out .fc.opp { animation-name: fcOutR; }
#fightCards.out .fc-mid { animation: fcRise var(--dur-med) var(--ease-out) forwards; }
@keyframes fcInL { from { transform: translateX(-120%); opacity: 0; } }
@keyframes fcInR { from { transform: translateX(120%); opacity: 0; } }
@keyframes fcOutL { to { transform: translateX(-120%); opacity: 0; } }
@keyframes fcOutR { to { transform: translateX(120%); opacity: 0; } }
@keyframes fcDrop { from { transform: translateY(-160px); opacity: 0; } }
@keyframes fcRise { to { transform: translateY(-160px); opacity: 0; } }
html[data-bucket="S"] .fc .portrait { display: none; }
html[data-bucket="S"] #fightCards { gap: var(--sp-1); padding: 0 4px; } html[data-bucket="S"] .fc { padding: var(--sp-1) var(--sp-2); }
/* S: the strip must clear the fighters' heads and the ring-card sign — drop the two least-read rows and tighten the leading */
html[data-bucket="S"] .fc-row.streak, html[data-bucket="S"] .fc-row.fights { display: none; }
html[data-bucket="S"] .fc-row { line-height: 1.1; } html[data-bucket="S"] .fc-tier { margin: 0 0 var(--sp-1); } html[data-bucket="S"] .fc-mid { padding-top: 0; }
.rc-sub:empty { display: none; }
#centreCard { position: absolute; left: calc(var(--scene-left) + 320px * var(--scene-scale)); top: calc(var(--scene-top) + 96px * var(--scene-scale)); transform: translate(-50%, -50%); text-align: center; white-space: nowrap; }
#centreBig { font-size: var(--fs-title); color: var(--bone); text-shadow: 3px 3px 0 var(--ink); animation: slam 180ms var(--ease-slam); }
#centreBig.inter { font-size: var(--fs-h); font-size: calc(var(--fs-title) * 0.5); }
@keyframes slam { from { transform: scale(3); } to { transform: scale(1); } }
#centreCard.has-img #centreBig { display: none; }
.title-img { background-repeat: no-repeat; background-size: 100% 100%; image-rendering: pixelated; margin: 0 auto; }
#centreCard .title-img { width: calc(160px * (var(--ui) + 1)); height: calc(48px * (var(--ui) + 1)); animation: slam 180ms var(--ease-slam); }
.title-img.title_ko { background-image: var(--img-title_ko); } .title-img.title_tko { background-image: var(--img-title_tko); }
.title-img.title_win { background-image: var(--img-title_win); } .title-img.title_lose { background-image: var(--img-title_lose); } .title-img.title_draw { background-image: var(--img-title_draw); }
#centreSub { display: inline-block; margin-top: 8px; padding: 2px 12px; font-size: var(--fs-small); color: var(--bone); background: var(--arena-black); box-shadow: 0 0 0 1px var(--ink); }
#centreSub:empty { display: none; }
#scoreCard { position: absolute; left: calc(var(--scene-left) + 336px * var(--scene-scale)); top: calc(var(--scene-top) + 40px * var(--scene-scale)); width: calc(136px * var(--scene-scale)); min-height: calc(72px * var(--scene-scale)); padding: 6px 10px; background: var(--panel); box-shadow: inset var(--bv) var(--bv) 0 var(--steel), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--slate), 0 0 0 var(--bv) var(--ink); }
.sc-title { font-size: var(--fs-h); color: var(--white); text-align: center; margin-bottom: 4px; }
#scoreTable { width: 100%; border-collapse: collapse; color: var(--white); font-size: var(--fs-body); font-variant-numeric: tabular-nums; }
#scoreTable td { padding: 0 4px; text-align: center; line-height: 1.2; }
#scoreTable td.me { color: var(--self-hi); } #scoreTable td.op { color: var(--opp-hi); }
#scoreTable tr.tot td { border-top: 1px solid var(--steel); }
#riseBar { position: absolute; left: calc(var(--scene-left) + 224px * var(--scene-scale)); top: calc(var(--scene-top) + 114px * var(--scene-scale)); width: calc(192px * var(--scene-scale)); height: calc(12px * var(--scene-scale)); background: var(--coal); box-shadow: inset 1px 1px 0 var(--steel), inset -1px -1px 0 var(--ink), 0 0 0 1px var(--ink); }
#countGreen { position: absolute; top: 1px; bottom: 1px; background: var(--ok); }
#countCursor { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--white); box-shadow: 0 0 0 1px var(--ink); }
#riseHint { position: absolute; left: calc(var(--scene-left) + 320px * var(--scene-scale)); top: calc(var(--scene-top) + 136px * var(--scene-scale)); transform: translateX(-50%); white-space: nowrap; font-size: var(--fs-small); color: var(--ash); text-shadow: 1px 1px 0 var(--ink); }
/* key cue strip: lights 100 ms when a press is actually sent */
#keys { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 4px; align-items: center; }
#keys span { min-width: 28px; height: 24px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: var(--fs-small); color: var(--steel); background: var(--arena-black); box-shadow: inset 1px 1px 0 var(--slate), 0 0 0 1px var(--ink); }
#keys span.lit { color: var(--ink); background: var(--warn); box-shadow: inset 1px 1px 0 var(--white), 0 0 0 1px var(--ink); }
#keys em { width: 8px; }
html.is-touch #keys { display: none; }

/* ---- menu card / board ---- */
.logo { width: calc(192px * var(--ui)); height: calc(48px * var(--ui)); margin: 0 auto; background: var(--img-logo) no-repeat 0 0 / 100% 100%; image-rendering: pixelated; color: transparent; font-size: 0; }
.logo span { display: none; }
.card { text-align: center; }
.tagline { color: var(--ash); font-size: var(--fs-body); margin: var(--sp-2) 0 var(--sp-3); }
#nameInput { display: block; width: 100%; height: var(--btn-h); margin: 0 auto var(--sp-2); padding: 0 var(--sp-3); font: inherit; font-size: var(--fs-body); text-align: center; text-transform: uppercase; color: var(--bone); background: var(--arena); border: 0; outline: none; caret-color: var(--bone); pointer-events: auto;
  box-shadow: inset var(--bv) var(--bv) 0 var(--slate), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--ink), 0 0 0 var(--bv) var(--ink); }
#nameInput::placeholder { color: var(--steel); }
#fightBtn { width: 100%; }
.swap-row { height: calc(var(--btn-h) + var(--sp-2)); margin-top: var(--sp-2); display: flex; align-items: center; justify-content: center; }
.hint { color: var(--ash); font-size: var(--fs-small); line-height: 1.25; }
.hint-s { display: none; }
#queueSearch { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); }
#queueCancelBtn { width: 160px; min-width: 0; }
.winline { color: var(--ash); font-size: var(--fs-small); margin-top: var(--sp-1); }
.menu-msg { color: var(--self-hi); font-size: var(--fs-small); margin-top: var(--sp-2); }
.live-badge { color: var(--ok); font-size: var(--fs-small); margin-top: var(--sp-2); }
#meCard { margin: var(--sp-3) auto 0; padding: var(--sp-2) var(--sp-3); text-align: left; background: var(--panel); font-size: var(--fs-small); box-shadow: inset 1px 1px 0 var(--steel), inset -1px -1px 0 var(--slate), 0 0 0 1px var(--ink); }
#meCard .me-row { display: flex; justify-content: space-between; color: var(--bone); }
#meCard .me-row b { color: var(--white); font-weight: 400; }
#meCard .tier { color: var(--gold-hi); }
.board { position: absolute; left: calc(100% + 24px); top: 0; width: var(--board-w); padding: var(--sp-2); background: var(--panel); text-align: left; transition: opacity var(--dur-med) var(--ease-out);
  box-shadow: inset var(--bv) var(--bv) 0 var(--steel), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--slate), 0 0 0 var(--bv) var(--ink); }
.board.off { opacity: 0; pointer-events: none; }
.board-tabs { display: flex; gap: 4px; margin-bottom: var(--sp-2); }
.board-tabs .tab { flex: 1; min-width: 0; height: 32px; font-size: var(--fs-small); letter-spacing: 0.04em; color: var(--ash); background: var(--arena); border: 0; pointer-events: auto; box-shadow: inset 1px 1px 0 var(--slate), inset -1px -1px 0 var(--ink), 0 0 0 1px var(--ink); }
.board-tabs .tab.active { color: var(--white); background: var(--opp); box-shadow: inset 1px 1px 0 var(--opp-hi), inset -1px -1px 0 var(--opp-shade), 0 0 0 1px var(--ink); }
#boardList { list-style: none; color: var(--bone); font-size: var(--fs-body); max-height: calc(20 * var(--fs-body) * 1.25); overflow: hidden; }
#boardList li { display: flex; gap: var(--sp-2); padding: 0 4px; line-height: 1.25; white-space: nowrap; }
#boardList li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; }
#boardList li .r { color: var(--white); } #boardList li .t { color: var(--gold-hi); width: 10ch; } #boardList li .i { color: var(--steel); width: 3ch; }
#boardList li.dim { color: var(--steel); } #boardList li.me { color: var(--self-hi); }
html[data-bucket="S"] .tagline { display: none; }
html[data-bucket="S"] .hint { display: none; } html[data-bucket="S"] .hint-s { display: block; }
html[data-bucket="S"] .board { position: static; width: 100%; margin-top: var(--sp-3); }
html[data-bucket="S"] #boardList { max-height: calc(10 * var(--fs-body) * 1.25); }
@media (max-height: 420px) { .board { display: none; } #meCard { display: none !important; } }

/* ---- VS ---- */
.vs-row { display: flex; align-items: center; justify-content: center; gap: var(--sp-5); }
.vs-side { width: 40%; text-align: center; }
.vs-side .portrait { width: calc(32px * var(--ui)); height: calc(32px * var(--ui)); margin: 0 auto var(--sp-2); }
.vs-side.opp .vs-name, .vs-side.opp .vs-rating { animation: slideIn var(--dur-med) var(--ease-snap); }
.vs-name { font-size: var(--fs-name); color: var(--white); }
.vs-rating { color: var(--ash); font-size: var(--fs-small); }
.vs-text { font-size: var(--fs-title); color: var(--white); animation: slam var(--dur-fast) var(--ease-slam); }
.badge { display: inline-block; width: calc(24px * var(--ui)); height: calc(24px * var(--ui)); background: var(--img-rank_badges) no-repeat 0 0; background-size: calc(144px * var(--ui)) 100%; image-rendering: pixelated; vertical-align: middle; }
.badge.b1 { background-position: calc(-24px * var(--ui)) 0; } .badge.b2 { background-position: calc(-48px * var(--ui)) 0; } .badge.b3 { background-position: calc(-72px * var(--ui)) 0; } .badge.b4 { background-position: calc(-96px * var(--ui)) 0; } .badge.b5 { background-position: calc(-120px * var(--ui)) 0; }
.vs-side .badge { margin-top: var(--sp-1); }
.q-title { font-size: var(--fs-h); color: var(--white); margin-bottom: var(--sp-2); }

/* ---- RESULT: tale of the tape ---- */
.result-col { text-align: center; }
.result-col .title-img { width: calc(160px * var(--ui)); height: calc(48px * var(--ui)); }
.result-title { font-size: var(--fs-title); color: var(--gold-hi); text-shadow: 4px 4px 0 var(--gold-shade), 6px 6px 0 var(--ink); }
.result-title.loss { color: var(--ash); text-shadow: 4px 4px 0 var(--slate), 6px 6px 0 var(--ink); }
.result-title.draw { color: var(--bone); text-shadow: 4px 4px 0 var(--slate), 6px 6px 0 var(--ink); }
.result-col.has-img .result-title { display: none; }
.result-method { color: var(--bone); font-size: var(--fs-body); margin: 0 0 var(--sp-1); line-height: 1.2; }
.tape { background: var(--arena-black); padding: var(--sp-2) var(--sp-4); text-align: left; box-shadow: inset var(--bv) var(--bv) 0 var(--slate), inset calc(-1 * var(--bv)) calc(-1 * var(--bv)) 0 var(--ink), 0 0 0 var(--bv) var(--ink); }
.tape-head { display: grid; grid-template-columns: var(--tape-port) 1fr auto 1fr var(--tape-port); align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.tape-head .portrait { width: var(--tape-port); height: var(--tape-port); }
.tn { font-size: var(--fs-name); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn.self { color: var(--self); } .tn.opp { color: var(--opp); text-align: right; }
.tc { font-size: var(--fs-small); color: var(--ok-dim); }
.tape-body .row { display: grid; grid-template-columns: var(--tv) var(--tb) var(--tl) var(--tb) var(--tv); align-items: center; height: var(--row-h); justify-content: center; }
.tape-body .v { font-size: var(--fs-body); color: var(--ash); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tape-body .v.l { text-align: right; padding-right: 6px; } .tape-body .v.r { text-align: left; padding-left: 6px; }
.tape-body .v.best { color: var(--white); }
.tape-body .lbl { text-align: center; font-size: var(--fs-body); color: var(--ash); white-space: nowrap; }
.tape-body .lbl.hd { color: var(--white); }
.bar { position: relative; height: 12px; }
.bar i, .bar b { position: absolute; top: 0; height: 12px; width: 0; transition: width var(--dur-slow) var(--ease-out); }
.bar.self i, .bar.self b { right: 0; } .bar.opp i, .bar.opp b { left: 0; }
.bar.self i { background: var(--self-deep); } .bar.self b { background: var(--self); }
.bar.opp i { background: var(--opp-deep); } .bar.opp b { background: var(--opp); }
.rating-row { margin-top: var(--sp-1); font-size: var(--fs-h); color: var(--white); text-align: center; line-height: 1.1; }
.rating-row .d.up { color: var(--gold-hi); } .rating-row .d.down { color: var(--self-hi); }
.rating-row .streak { color: var(--ash); font-size: var(--fs-body); margin-left: var(--sp-2); }
.rating-row .opp-line { display: block; font-size: var(--fs-small); color: var(--steel); margin: var(--sp-1) 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-btns { display: flex; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-2); }
.result-btns-2 { display: flex; gap: var(--sp-2); }
.result-btns .btn { min-width: 160px; }
html[data-bucket="S"] .result-btns { flex-direction: column; align-items: stretch; }
html[data-bucket="S"] .result-btns .btn { min-width: 0; flex: 1; width: 100%; }
html[data-bucket="S"] .tape-body { max-height: calc(100dvh - var(--hud-h) - 330px); overflow-y: auto; }
html[data-bucket="S"] .tape-head { grid-template-columns: 1fr auto 1fr; } html[data-bucket="S"] .tape-head .portrait { display: none; }

/* ---- touch controls: right gutter over the canvas ---- */
#touchControls { position: absolute; inset: 0; pointer-events: none; }
#tcZone { position: absolute; left: 0; bottom: 0; width: 50%; height: 70%; pointer-events: auto; }
#gutter { position: absolute; right: 0; top: 0; bottom: 0; width: 176px; background: rgba(14, 10, 20, 0.6); pointer-events: auto; }
#tcPad { position: absolute; right: 8px; bottom: 8px; width: 160px; display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 64px; gap: 8px; }
.tcBtn { height: auto; min-width: 0; padding: 0; font-size: 16px; opacity: 0.9; box-shadow: inset 1px 1px 0 var(--opp-hi), inset -1px -1px 0 var(--opp-shade), 0 0 0 1px var(--ink); }
#tcOvh { grid-column: 1; grid-row: 1; } #tcClinch { grid-column: 2; grid-row: 1; } #tcL { grid-column: 1; grid-row: 2; } #tcR { grid-column: 2; grid-row: 2; } #tcBlock { grid-column: 1; grid-row: 3; } #tcDuck { grid-column: 2; grid-row: 3; }
.tcBtn::before { content: ""; width: 64px; height: 64px; background: var(--img-touch_glyphs) no-repeat; background-size: 384px 64px; image-rendering: pixelated; }
#tcL, #tcR, #tcBlock, #tcDuck { font-size: 0; }
#tcL::before { background-position: 0 0; } #tcR::before { background-position: -64px 0; } #tcBlock::before { background-position: -128px 0; } #tcDuck::before { background-position: -192px 0; }
#tcOvh::before, #tcClinch::before { display: none; }
html.is-touch.is-portrait body.infight #rotate { display: block !important; opacity: 1; pointer-events: none; }
#rotate .card, #fullMsg .card { pointer-events: auto; }
html.is-touch.is-portrait #hudBar .sil, html.is-touch.is-portrait #hudBar .portrait { display: none; }
html.is-touch.is-portrait { --plate-w: 130px; --stam-w: 110px; --clock-w: 100px; }
html.is-touch.is-portrait .prank { display: none; }
html.is-touch.is-portrait .pname { max-width: calc(var(--plate-w) - 12px); }
html[data-bucket="S"] .pname { max-width: calc(var(--plate-w) - 90px); }

/* Keep the result buttons inside compact desktop heights. */
@media (max-height: 700px) { html[data-bucket="M"] .result-btns { margin-top: var(--sp-1); } }
