/* GAG ROYALE. Fight night on a TV broadcast: Tom's photograph, two corners (hot orange = you, blue = the opponent),
   gold for the crown and the scores, red for damage. Anton for everything shouted, Archivo for everything read.
   Solid colour, hard edges and hard shadows; motion does the decorating (motion.js). No glass, no soft glows,
   no gradient buttons, no letter-spaced caption labels. */
:root {
  --bg: #0c0a0b; --panel: #171315; --panel-2: #201a1c; --line: #362b2d; --ink: #f6eddc; --muted: #bdb0a0; --dim: #7c7067;
  --you: #ff5a1f; --them: #2f8cff; --gold: #ffc531; --red: #ff2a3d; --blood: #9e1420;
  /* old names, still read by a few rules */
  --orange: var(--you); --blue: var(--them);
  --display: Anton, Impact, 'Arial Narrow', sans-serif; --body: Archivo, Arial, sans-serif;
  --snap: cubic-bezier(.2, 1.5, .35, 1); --out: cubic-bezier(.16, 1, .3, 1); --in: cubic-bezier(.7, 0, .84, 0);
  --intro: 2.6s; --take: 3s;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
/* Film grain over everything: printed paper, not a flat screen. */
body::before { content: ''; position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .5s steps(3) infinite; }
@keyframes grain { 33% { transform: translate(-3%, 2%); } 66% { transform: translate(2%, -3%); } }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.ch.sp { white-space: pre; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.crown-mark { width: .62em; height: .43em; fill: var(--gold); flex: none; }

/* ---------- buttons ---------- */
.btn { min-height: 46px; padding: 10px 20px; border: 3px solid var(--ink); background: transparent; font-weight: 800; letter-spacing: .01em; transition: background .12s, color .12s, transform .12s; }
.btn:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: .4; }
.btn-gold { border-color: var(--gold); background: var(--gold); color: #140f05; box-shadow: 5px 5px 0 var(--blood); }
.btn-gold:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
.btn-gold:active:not(:disabled) { box-shadow: 2px 2px 0 var(--blood); transform: translate(3px, 3px); }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn-small { min-height: 34px; padding: 4px 12px; }
.inline-link { border: 0; background: none; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 clamp(14px, 3vw, 40px); background: var(--bg); border-bottom: 2px solid var(--line); }
.wordmark-small { display: flex; align-items: center; gap: .1em; font: 28px/1 var(--display); color: var(--ink); text-decoration: none; text-transform: uppercase; }
.wordmark-small span:last-child { color: var(--gold); }
.wordmark-small .crown-mark { margin: 0 .06em; transform: translateY(-.24em) rotate(-10deg); }
.wordmark-small:hover .crown-mark { animation: crown-hop .5s var(--snap); }
@keyframes crown-hop { 40% { transform: translateY(-.55em) rotate(12deg); } }
.topbar nav { display: flex; gap: 2px; }
.topbar-btn { position: relative; white-space: nowrap; padding: 8px 11px; border: 0; background: none; color: var(--muted); font-weight: 800; font-size: 14px; text-decoration: none; }
.topbar-btn::after { content: ''; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 3px; background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform .2s var(--out); }
.topbar-btn:hover { color: var(--ink); }
.topbar-btn:hover::after { transform: scaleX(1); }
#notice { position: sticky; top: 60px; z-index: 19; margin: 0; padding: 12px clamp(14px, 3vw, 40px); background: var(--red); color: #fff; font-weight: 800; animation: drop-in .35s var(--out); }
@keyframes drop-in { from { transform: translateY(-100%); } }
.notice-action { margin-left: 8px; padding: 6px 12px; border: 2px solid #fff; background: transparent; color: #fff; font: inherit; cursor: pointer; }

/* ---------- home: Tom's photograph cut on the diagonal, the title, one big button ---------- */
#home { min-height: calc(100svh - 60px); display: flex; }
.stage { position: relative; flex: 1; display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); align-items: center; overflow: hidden; }
.stage-portrait { position: relative; align-self: stretch; margin: 0; min-height: 360px; overflow: hidden; background: #1d1719; clip-path: polygon(0 0, 100% 0, 84% 100%, 0 100%); }
.stage-tom { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; filter: contrast(1.12) saturate(.88); transform-origin: 50% 30%; animation: tom-drift 18s ease-in-out infinite alternate; }
@keyframes tom-drift { from { transform: scale(1.08) translate(0, 0); } to { transform: scale(1.16) translate(-1.5%, 1%); } }
/* Printed dots over the bottom of the photograph, where the name sits. */
.stage-portrait::after { content: ''; position: absolute; inset: 45% 0 0; background: radial-gradient(circle, #0c0a0b 1.3px, transparent 1.6px) 0 0 / 7px 7px; mask-image: linear-gradient(transparent, #000 75%); -webkit-mask-image: linear-gradient(transparent, #000 75%); }
.stage-portrait figcaption { position: absolute; left: clamp(18px, 3vw, 40px); bottom: clamp(18px, 4vh, 40px); z-index: 1; }
.stage-portrait strong { display: block; font: 400 clamp(46px, 5.6vw, 92px)/.86 var(--display); text-transform: uppercase; color: var(--ink); -webkit-text-stroke: 2px #0c0a0b; paint-order: stroke fill; }
.stage-portrait strong::after { content: ''; display: block; width: 1.6em; height: .14em; margin-top: .12em; background: var(--gold); }
/* The orange slash along the cut. */
.stage-portrait::before { content: ''; position: absolute; inset: 0; z-index: 2; background: var(--you); clip-path: polygon(calc(100% - 16px) 0, 100% 0, 84% 100%, calc(84% - 16px) 100%); transform-origin: top; pointer-events: none; }
.stage-inner { position: relative; z-index: 2; width: min(640px, 100%); padding: clamp(16px, 4.5svh, 56px) clamp(20px, 4vw, 56px); }   /* home: every height below shrinks with the window so it never scrolls */
.invite-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; padding: 12px 16px; background: var(--them); color: #04101f; font-weight: 800; animation: drop-in .4s var(--snap); }
.invite-banner p { margin: 0; font-size: 18px; }
.wordmark { margin: 0; font: 400 clamp(64px, min(10.5vw, 16svh), 168px)/.86 var(--display); text-transform: uppercase; }
.wordmark > span { position: relative; display: block; white-space: nowrap; }
.w-gag { color: var(--ink); }
.w-royale { color: var(--gold); margin-top: .1em; text-shadow: .045em .045em 0 var(--blood); }
.w-gag { text-shadow: .045em .045em 0 #3a2a2d; }
.wordmark .ch { display: inline-block; }
.w-royale .crown-mark { position: absolute; left: -.08em; top: -.2em; width: .42em; height: .29em; transform: rotate(-16deg); filter: drop-shadow(.04em .04em 0 var(--blood)); }
.tagline { margin: clamp(10px, 2.8svh, 26px) 0 4px; font: 400 clamp(26px, 2.6vw, 38px)/1 var(--display); text-transform: uppercase; color: var(--ink); }
.match-note { margin: 0 0 clamp(12px, 2.8svh, 26px); color: var(--muted); font-size: 16px; font-weight: 600; }
.play-row { display: grid; gap: clamp(8px, 1.5svh, 14px); }
.btn-play { position: relative; width: 100%; height: clamp(62px, 9.8svh, 88px); padding: 0 30px; border: 0; background: none; color: #140f05; font: 400 clamp(34px, 3.4vw, 48px)/1 var(--display); text-transform: uppercase; filter: drop-shadow(7px 7px 0 var(--blood)); transition: transform .12s, filter .12s; isolation: isolate; }
.btn-play::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--gold); clip-path: polygon(3% 0, 100% 0, 97% 100%, 0 100%); transition: background .15s; }
/* A light sweep crosses the button every few seconds. */
.btn-play::after { content: ''; position: absolute; inset: 0; z-index: -1; clip-path: polygon(3% 0, 100% 0, 97% 100%, 0 100%); background: linear-gradient(105deg, transparent 40%, #fff9e8 47%, #fff9e8 53%, transparent 60%) no-repeat; background-size: 250% 100%; background-position: 160% 0; animation: sweep 3.6s 1.6s var(--out) infinite; mix-blend-mode: soft-light; }
@keyframes sweep { 0% { background-position: 160% 0; } 35%, 100% { background-position: -60% 0; } }
.btn-play span { display: inline-block; transition: transform .2s var(--snap); }
.btn-play:hover:not(:disabled)::before { background: var(--ink); }
.btn-play:hover:not(:disabled) span { transform: scale(1.06); }
.btn-play:active:not(:disabled) { transform: translate(5px, 5px); filter: drop-shadow(2px 2px 0 var(--blood)); }
.btn-play:disabled { opacity: .45; }
.play-side { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.live { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-weight: 600; font-size: 14px; }
.live::before { content: ''; width: 9px; height: 9px; background: var(--red); border-radius: 50%; animation: live 1.4s ease-in-out infinite; }
@keyframes live { 50% { opacity: .25; } }
.live b { color: var(--ink); font: 400 24px/1 var(--display); }
.fighter-name { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.fighter-name input { width: 170px; padding: 7px 10px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); font: 400 20px/1 var(--display); text-transform: uppercase; transition: border-color .15s; }
.fighter-name input:focus { border-color: var(--gold); outline: 0; }
.modes { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: clamp(10px, 2.4svh, 22px) 0 0; padding: 0; }
.mode { position: relative; width: 100%; height: 100%; display: grid; align-content: start; gap: 5px; padding: clamp(10px, 1.6svh, 14px) 16px clamp(11px, 1.8svh, 16px) 20px; border: 0; background: var(--panel); text-align: left; overflow: hidden; isolation: isolate; transition: color .18s; }
.mode::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 6px; z-index: -1; background: var(--c, var(--them)); transition: width .28s var(--out); }
.mode b { font: 400 30px/1 var(--display); text-transform: uppercase; }
.mode span { color: var(--muted); font-size: 14px; transition: color .18s; }
.mode em { display: block; color: var(--gold); font-style: normal; font-weight: 800; }
#tom-btn { --c: var(--you); }
#friend-btn { --c: var(--them); }
.mode:hover:not(:disabled), .mode:focus-visible { color: #0c0a0b; }
.mode:hover:not(:disabled)::before, .mode:focus-visible::before { width: 100%; }
.mode:hover:not(:disabled) span, .mode:hover:not(:disabled) em { color: #0c0a0b; }
.mode:disabled { opacity: .5; }

/* The home screen arrives: Tom is cut in, the title drops letter by letter, the button lands last. */
.is-entering .stage-portrait { animation: cut-in .9s var(--out) both; }
.is-entering .stage-portrait::before { animation: slash-in .5s .55s var(--out) both; }
.is-entering .stage-portrait figcaption { animation: rise .6s .7s var(--out) both; }
.is-entering .wordmark .ch { animation: letter-drop .55s calc(.25s + var(--i) * 55ms) var(--snap) both; }
.is-entering .w-royale .crown-mark { animation: crown-drop .8s 1.05s var(--snap) both; }
.is-entering .tagline { animation: rise .5s .85s var(--out) both; }
.is-entering .match-note { animation: rise .5s .95s var(--out) both; }
.is-entering .btn-play { animation: play-land .55s 1.05s var(--snap) both; }
.is-entering .play-side, .is-entering .rank-strip { animation: rise .5s 1.2s var(--out) both; }
.is-entering .modes li { animation: rise .5s calc(1.3s + var(--n, 0) * 80ms) var(--out) both; }
.modes li:nth-child(2) { --n: 1; }
@keyframes cut-in { from { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); } }
@keyframes slash-in { from { transform: scaleY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes letter-drop { 0% { opacity: 0; transform: translateY(-.9em) rotate(-8deg) scaleY(1.3); } 60% { opacity: 1; transform: translateY(.04em) scaleY(.86) scaleX(1.08); } 100% { transform: none; } }
@keyframes crown-drop { 0% { opacity: 0; transform: translateY(-2.4em) rotate(-200deg); } 60% { opacity: 1; transform: translateY(.1em) rotate(-10deg); } 80% { transform: translateY(-.15em) rotate(-20deg); } 100% { transform: rotate(-16deg); } }
@keyframes play-land { 0% { opacity: 0; transform: scale(1.35) rotate(-2deg); } 60% { opacity: 1; transform: scale(.96); } }

/* ---------- rank: nine steps of a staircase, the current one filled as far as the player has climbed it ---------- */
.rank-strip, .rank-change { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "steps name" "steps note"; column-gap: 16px; align-items: end; }
.rank-strip { margin-top: clamp(10px, 2svh, 18px); padding: 10px 14px; background: var(--panel); border-left: 6px solid var(--gold); }
.steps { grid-area: steps; list-style: none; display: flex; align-items: flex-end; gap: 3px; height: 40px; margin: 0; padding: 0; }
.steps li { position: relative; width: 9px; background: var(--line); overflow: hidden; }
.steps li i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--gold); transition: height .8s var(--out); }
.rank-name { grid-area: name; margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 12px; font: 400 28px/1 var(--display); text-transform: uppercase; color: var(--gold); }
.rank-name b { font-weight: 400; color: var(--ink); font-variant-numeric: tabular-nums; }
.rank-name em { font-style: normal; font-variant-numeric: tabular-nums; }
.rank-name em.up { color: var(--gold); }
.rank-name em.down { color: var(--red); }
.rank-note { grid-area: note; margin: 4px 0 0; color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- camera check ---------- */
.check { display: grid; justify-items: center; align-content: center; gap: 16px; min-height: calc(100svh - 60px); padding: 24px 16px 40px; text-align: center; }
.check h2 { margin: 0; font: 400 clamp(40px, 5vw, 64px)/1 var(--display); text-transform: uppercase; }
.mirror { position: relative; width: min(560px, 100%); aspect-ratio: 4 / 3; background: var(--panel); overflow: hidden; border: 4px solid var(--you); }
.mirror video, .mirror canvas, .fighter video, .fighter canvas.mesh { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mirror video, .mirror canvas, #local-video, #local-mesh { transform: scaleX(-1); }
/* A scan line sweeps the mirror until the face is found. */
.mirror::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 30%; z-index: 2; background: linear-gradient(transparent, rgb(255 197 49 / .22) 85%, var(--gold) 86%, transparent 88%); animation: scanline 1.8s linear infinite; pointer-events: none; }
.check.face-ok .mirror::before { display: none; }
@keyframes scanline { from { transform: translateY(-100%); } to { transform: translateY(340%); } }
.corner { position: absolute; z-index: 2; width: 38px; height: 38px; border: 5px solid var(--gold); transition: inset .4s var(--snap), border-color .2s; }
.c1 { top: 12px; left: 12px; border-right: 0; border-bottom: 0; } .c2 { top: 12px; right: 12px; border-left: 0; border-bottom: 0; }
.c3 { bottom: 12px; left: 12px; border-right: 0; border-top: 0; } .c4 { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }
.check:not(.face-ok) .corner { animation: corner-breathe 1.2s ease-in-out infinite; }
.check.face-ok .c1 { top: 22%; left: 26%; } .check.face-ok .c2 { top: 22%; right: 26%; } .check.face-ok .c3 { bottom: 16%; left: 26%; } .check.face-ok .c4 { bottom: 16%; right: 26%; }
@keyframes corner-breathe { 50% { opacity: .45; } }
.mirror-tag { position: absolute; z-index: 3; left: 50%; bottom: 16px; transform: translateX(-50%); margin: 0; padding: 7px 14px; background: #0c0a0b; font: 400 20px/1 var(--display); text-transform: uppercase; white-space: nowrap; }
.check.face-ok .mirror-tag { background: var(--gold); color: #140f05; animation: pop-in .35s var(--snap); }
.checks { list-style: none; display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; margin: 0; padding: 0; color: var(--dim); font-weight: 800; }
.checks li { display: flex; align-items: center; gap: 8px; transition: color .2s; }
.checks li::before { content: ''; width: 20px; height: 20px; border: 3px solid currentColor; transition: background .2s; }
.checks li.ok { color: var(--ink); }
.checks li.ok::before { background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10.5l4 4 8-9' fill='none' stroke='%23140f05' stroke-width='3.4'/%3E%3C/svg%3E") center / 100%; border-color: var(--gold); animation: pop-in .3s var(--snap); }
@keyframes pop-in { from { transform: scale(1.8); } }
.mic-bar { width: 64px; height: 8px; background: var(--line); }
.mic-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .08s linear; }
.check-note { max-width: 32em; margin: 0; color: var(--muted); }
.check-actions, .dialog-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#check-go { min-width: 150px; font: 400 26px/1 var(--display); text-transform: uppercase; }
/* No usable camera: the mirror says why and the way on by voice alone sits in the middle, big. */
.cam-fail { display: none; }
.check:not(.is-failed) #cam-retry, .check.is-failed #check-go, .check.is-failed .checks, .check.is-failed .check-note, .check.is-failed .mirror-tag, .check.is-failed .mirror::before, .check.is-failed .mirror::after { display: none; }
.check.is-failed .mirror { display: grid; place-items: center; aspect-ratio: auto; min-height: min(420px, 75vw); }
.check.is-failed .corner { border-color: var(--red); animation: none; }
.check.is-failed .cam-fail { position: relative; z-index: 3; display: grid; justify-items: center; gap: 12px; width: 100%; padding: 34px clamp(18px, 5vw, 44px); animation: rise .45s var(--out) both; }
.cam-fail-title { margin: 0; font: 400 clamp(34px, 4.4vw, 52px)/.95 var(--display); text-transform: uppercase; color: var(--red); }
.cam-fail-text { max-width: 26em; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.btn-voice { width: min(440px, 100%); height: 76px; font-size: clamp(28px, 3.2vw, 40px); }
.check.is-failed .btn-voice { animation: play-land .55s .2s var(--snap) both; }
.cam-fail-note { color: var(--ink); font-weight: 800; }

/* ---------- arena: HUD ---------- */
#arena { position: relative; overflow: clip; padding: 14px clamp(10px, 2.5vw, 32px) 32px; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(10px, 2vw, 24px); align-items: center; max-width: 1280px; margin: 0 auto 14px; }
.hud-name { margin: 0 0 6px; font: 400 clamp(20px, 2.4vw, 30px)/1 var(--display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-you .hud-name { color: var(--you); }
.hud-them .hud-name { color: var(--them); }
.hud-them { text-align: right; }
.life { position: relative; height: clamp(20px, 2.8vh, 28px); border: 3px solid var(--ink); background: #2a0d12; overflow: hidden; transform: skewX(-18deg); }
.hud-them .life { transform: skewX(18deg); }
.life i { position: absolute; top: 0; bottom: 0; width: 100%; }
.hud-you .life i { left: 0; }
.hud-them .life i { right: 0; }
.life-lag { background: var(--red); transition: width .6s cubic-bezier(.5, 0, .75, 0); }
.life-fill { background: var(--gold); transition: width .12s linear; box-shadow: inset 0 -5px 0 rgb(0 0 0 / .18); }
.life-fill.low { background: var(--you); animation: low-life .5s steps(2) infinite; }
@keyframes low-life { 50% { background: var(--red); } }
.life::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: 0; }
.life.hit::after { animation: bar-flash .35s ease-out; }
.life.hit { animation: bar-shake .35s linear; }
@keyframes bar-flash { 0% { opacity: .95; } 100% { opacity: 0; } }
@keyframes bar-shake { 25% { translate: 5px -2px; } 50% { translate: -4px 2px; } 75% { translate: 3px 0; } }
.pips { list-style: none; display: flex; gap: 7px; margin: 8px 0 0; padding: 0; }
.hud-them .pips { justify-content: flex-end; }
.pips li { width: 14px; height: 14px; border: 2px solid var(--muted); transform: rotate(45deg); }
.pips li.won { background: var(--gold); border-color: var(--gold); animation: pip-win .5s var(--snap); }
@keyframes pip-win { 0% { transform: rotate(45deg) scale(2.6); box-shadow: 0 0 0 0 var(--gold); } 100% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 12px rgb(255 197 49 / 0); } }
.hud-centre { min-width: 100px; padding: 6px 12px; border: 3px solid var(--ink); text-align: center; background: var(--bg); box-shadow: 5px 5px 0 var(--blood); }
#round-label { margin: 0; font: 400 15px/1 var(--display); text-transform: uppercase; color: var(--gold); }
#clock { margin: 2px 0 0; font: 400 clamp(34px, 4.4vw, 50px)/1 var(--display); font-variant-numeric: tabular-nums; }
[data-phase="record"] #clock { color: var(--red); }
.hud-plain .life, .hud-plain .pips { visibility: hidden; }
.hud-plain .hud-them { visibility: hidden; }

/* ---------- arena: the ring ---------- */
.ring { position: relative; display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "you them"; gap: 14px; max-width: min(1280px, (100vh - 260px) * 2.75); margin: 0 auto; transition: filter .6s, transform .6s; }
.fighter { position: relative; margin: 0; aspect-ratio: 4 / 3; overflow: hidden; background: var(--panel); border: 5px solid var(--you); transition: filter .25s, border-color .2s; }
.fighter-you { grid-area: you; }
.fighter-them { grid-area: them; border-color: var(--them); }
.tom-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
canvas.mesh { pointer-events: none; }
.plate { position: absolute; left: -8px; bottom: 12px; z-index: 3; margin: 0; padding: 6px 16px 5px 18px; background: var(--you); color: #120a05; font: 400 clamp(18px, 1.9vw, 26px)/1 var(--display); text-transform: uppercase; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transform: skewX(-12deg); box-shadow: 4px 4px 0 #0c0a0b; }
.plate-them { left: auto; right: -8px; padding: 6px 18px 5px 16px; background: var(--them); transform: skewX(12deg); }
/* The fighter's rank, small, just above the name plate. */
.tile-rank { position: absolute; left: 4px; bottom: calc(12px + clamp(18px, 1.9vw, 26px) + 17px); z-index: 3; margin: 0; padding: 4px 10px 3px 9px; background: rgb(12 10 11 / .8); border-left: 3px solid var(--gold); color: var(--ink); font: 400 15px/1 var(--display); text-transform: uppercase; white-space: nowrap; transform: skewX(-12deg); font-variant-numeric: tabular-nums; }
.tile-rank b { font-weight: 400; color: var(--gold); }
.tile-rank-them { left: auto; right: 4px; border-left: 0; border-right: 3px solid var(--gold); transform: skewX(12deg); }
.tile-rank[hidden] { display: none; }
/* Live sound level on the facing edge of each player. */
.meter { position: absolute; top: 12px; bottom: 12px; right: 12px; z-index: 3; width: 14px; background: rgb(12 10 11 / .7); border: 2px solid rgb(246 237 220 / .6); }
.fighter-them .meter { right: auto; left: 12px; }
.meter i { position: absolute; inset: 0; display: block; background: var(--gold); transform-origin: bottom; transform: scaleY(0);
  mask-image: repeating-linear-gradient(to top, #000 0 6px, transparent 6px 8px); -webkit-mask-image: repeating-linear-gradient(to top, #000 0 6px, transparent 6px 8px); }
/* The three seconds: red frame, a pulse from the edges, a bar running down under the picture. */
.is-recording { border-color: var(--red); }
.is-recording::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; box-shadow: inset 0 0 0 6px var(--red), inset 0 0 60px 10px rgb(255 42 61 / .45); animation: rec-pulse .6s ease-in-out infinite alternate; }
.is-recording::after { content: 'REC'; position: absolute; top: 14px; left: 16px; z-index: 3; display: flex; align-items: center; gap: 7px; padding: 4px 10px 3px; background: var(--red); color: #fff; font: 400 20px/1 var(--display); }
@keyframes rec-pulse { from { opacity: .55; } to { opacity: 1; } }
.take-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; height: 10px; background: rgb(12 10 11 / .7); opacity: 0; transition: opacity .15s; }
.take-bar i { position: absolute; inset: 0; background: var(--red); transform-origin: left; }
.is-recording .take-bar { opacity: 1; }
.is-recording .take-bar i { animation: take var(--take) linear both; }
@keyframes take { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.face-hint { position: absolute; top: 44%; left: 50%; z-index: 4; transform: translateX(-50%); margin: 0; padding: 8px 14px; background: var(--red); color: #fff; font-weight: 800; white-space: nowrap; animation: pop-in .3s var(--snap); }
.fighter.won { border-color: var(--gold); }
.fighter.lost video, .fighter.lost canvas, .fighter.lost img { filter: grayscale(.85) brightness(.65); transition: filter .4s; }
[data-phase="listen"] .fighter, [data-phase="call"] .fighter { filter: brightness(.5); }
[data-mode="tom"][data-phase="listen"] .fighter-them, [data-mode="practice"] .fighter-them { filter: none; }

/* Hits: the loser is knocked back with a red flash, the winner lunges in. */
.fighter.hit, .tom-screen.hit { animation: knock-you .45s cubic-bezier(.2, .9, .3, 1); }
.fighter-them.hit, .tom-screen.hit { animation-name: knock-them; }
.fighter.hit::before, .tom-screen.hit::before { content: ''; position: absolute; inset: 0; z-index: 6; background: var(--red); mix-blend-mode: multiply; animation: hit-red .5s ease-out forwards; pointer-events: none; }
@keyframes knock-you { 0% { transform: none; } 15% { transform: translateX(-28px) rotate(-1.6deg) scale(.97); } 100% { transform: none; } }
@keyframes knock-them { 0% { transform: none; } 15% { transform: translateX(28px) rotate(1.6deg) scale(.97); } 100% { transform: none; } }
@keyframes hit-red { 0% { opacity: 1; } 100% { opacity: 0; } }
.fighter-you.lunge { animation: lunge-you .4s var(--out); z-index: 4; }
.fighter-them.lunge, [data-mode="tom"] .tom-screen.lunge { animation: lunge-them .4s var(--out); z-index: 4; }
@keyframes lunge-you { 30% { transform: translateX(18px) scale(1.035); } }
@keyframes lunge-them { 30% { transform: translateX(-18px) scale(1.035); } }
/* K.O.: the ring drains of colour and leans in. */
.is-ko .ring { transform: scale(1.025); }
.is-ko .fighter, .is-ko .tom-screen { filter: saturate(.2) contrast(1.2); }

/* Tom's gag: his own corner when fighting him, a screen over the middle of the ring online. */
.tom-screen { position: absolute; z-index: 5; left: 50%; top: 50%; width: 48%; aspect-ratio: 4 / 3; transform: translate(-50%, -50%) scale(.6) rotate(-3deg); opacity: 0; background: #000; border: 6px solid var(--gold); overflow: hidden; box-shadow: 10px 10px 0 #0c0a0b; transition: transform .3s var(--snap), opacity .15s; }
.tom-screen.playing { transform: translate(-50%, -50%) scale(1); opacity: 1; }
[data-mode="tom"] .tom-screen, [data-mode="practice"] .tom-screen { position: relative; grid-area: them; left: 0; top: 0; width: auto; transform: none; opacity: 1; border: 5px solid var(--them); box-shadow: none; z-index: 2; }
[data-mode="tom"] .tom-screen.playing, [data-mode="practice"] .tom-screen.playing { border-color: var(--gold); }
.tom-screen video, .tom-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tom-screen img, .tom-still { object-position: 50% 14%; transform: scale(1.3); transform-origin: 50% 20%; }
.tom-screen.gagging img { animation: gag-shake .16s linear infinite; }
@keyframes gag-shake { 0% { transform: scale(1.34) translate(0, 0); } 25% { transform: scale(1.35) translate(-.6%, .4%); } 50% { transform: scale(1.34) translate(.5%, -.3%); } 75% { transform: scale(1.36) translate(-.3%, -.5%); } }
.tom-screen.gagging { border-color: var(--gold); }
.tom-screen-tag { position: absolute; right: 0; bottom: 0; margin: 0; padding: 5px 12px 4px; background: var(--gold); color: #140f05; font: 400 20px/1 var(--display); text-transform: uppercase; }
[data-mode="tom"] .fighter-them .plate, [data-mode="practice"] .fighter-them { visibility: hidden; }
[data-mode="tom"] .tom-screen-tag { display: none; }
[data-mode="tom"] .fighter-them { grid-area: them; z-index: 3; background: transparent; border-color: transparent; overflow: visible; }
[data-mode="tom"] .fighter-them .plate { visibility: visible; }
[data-mode="tom"] .fighter-them .tom-still { display: none; }
[data-mode="tom"] .fighter-them .meter { z-index: 4; }
[data-mode="tom"] .fighter-them.hit, [data-mode="tom"] .fighter-them.lunge { animation: none; }
[data-mode="tom"] .fighter-them.hit::before { display: none; }

/* Searching and invites sit in the opponent's corner: a radar until someone is found. */
.searching, .invite-card { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; background: var(--panel); text-align: center; overflow: hidden; }
.searching p { position: relative; z-index: 1; margin: 0; font: 400 clamp(26px, 3.2vw, 42px)/1 var(--display); text-transform: uppercase; }
.radar { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px; }
.radar i { position: absolute; left: -160px; top: -160px; width: 320px; height: 320px; border: 3px solid var(--them); border-radius: 50%; opacity: 0; animation: radar 2.4s var(--out) infinite; }
.radar i:nth-child(2) { animation-delay: .8s; } .radar i:nth-child(3) { animation-delay: 1.6s; }
@keyframes radar { 0% { transform: scale(.1); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
.searching small { position: relative; z-index: 1; color: var(--muted); font-weight: 800; }
.searching-actions { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.searching.found { background: var(--them); color: #04101f; animation: found .5s var(--snap); }
.searching.found .radar { display: none; }
@keyframes found { from { transform: scale(1.08); } }
.invite-card p { margin: 0; }
.invite-code { font: 400 58px/1 var(--display); letter-spacing: .08em; color: var(--gold); }
#invite-link { width: min(100%, 420px); padding: 8px; border: 2px solid var(--line); background: var(--bg); }
.invite-actions { display: flex; gap: 8px; }

/* Score pops and damage. */
.pop { position: absolute; inset: auto 0 0 0; z-index: 4; display: grid; justify-items: center; gap: 6px; padding: 18px 12px 52px; background: rgb(12 10 11 / .86); clip-path: polygon(0 14%, 100% 0, 100% 100%, 0 100%); }
.pop.slam { animation: pop-up .35s var(--out); }
@keyframes pop-up { from { transform: translateY(100%); } }
.pop-score { margin: 0; text-transform: uppercase; font: 400 clamp(68px, 9vw, 128px)/.9 var(--display); color: var(--gold); -webkit-text-stroke: 3px #000; paint-order: stroke fill; font-variant-numeric: tabular-nums; }
.pop-title { margin: 0; padding: 4px 12px; background: var(--ink); color: #140f05; font: 400 19px/1.1 var(--display); text-transform: uppercase; transform: skewX(-10deg); }
.pop.is-low .pop-score { color: var(--ink); font-size: clamp(42px, 6vw, 76px); }
.pop.is-foul .pop-score { color: var(--red); }   /* the −30 at full size */
.pop.is-foul .pop-title { background: var(--red); color: #fff; }
.pop.is-spinning .pop-score { color: var(--muted); filter: blur(.6px); }
.pop.is-spinning .pop-title, .pop.is-spinning .pop-bars { visibility: hidden; }
.pop.is-landed .pop-score { animation: score-land .45s var(--snap); }
@keyframes score-land { 0% { transform: scale(1.7); } 100% { transform: scale(1); } }
.pop-bars { display: grid; gap: 4px; width: min(260px, 90%); margin: 4px 0 0; }
.pop-bars div { display: grid; grid-template-columns: 48px 1fr 34px; align-items: center; gap: 8px; }
.pop-bars dt { font-weight: 800; font-size: 13px; color: var(--muted); }
.pop-bars dd { display: contents; margin: 0; }
.pop-bars i { display: block; height: 10px; width: 0; background: var(--gold); transition: width .6s var(--out); }
.pop-bars b { font: 400 18px/1 var(--display); text-align: right; }
.damage { position: absolute; top: 10%; left: 50%; z-index: 7; margin: 0; transform: translateX(-50%); font: 400 clamp(64px, 8vw, 110px)/1 var(--display); color: var(--red); -webkit-text-stroke: 4px #000; paint-order: stroke fill; pointer-events: none; }
.damage.slam { animation: damage 1.5s var(--out) forwards; }
@keyframes damage { 0% { transform: translate(-50%, 30px) scale(2.4) rotate(-8deg); opacity: 0; } 10% { transform: translate(-50%, 0) scale(.92) rotate(3deg); opacity: 1; } 18% { transform: translate(-50%, 0) scale(1) rotate(0); } 70% { opacity: 1; } 100% { transform: translate(-50%, -90px) scale(.6); opacity: 0; } }

/* ---------- calls: shouted words across the ring ---------- */
.call { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; pointer-events: none; font: 400 clamp(90px, 15vw, 220px)/1 var(--display); text-transform: uppercase; color: var(--gold); -webkit-text-stroke: 5px #000; paint-order: stroke fill; text-align: center; white-space: nowrap; }
.call:empty { display: none; }
.call .ch { display: inline-block; }
.call.is-small { font-size: clamp(56px, 8vw, 120px); }
.call.is-white { color: var(--ink); }
.call.is-red { color: var(--red); }
.call.slam { animation: slam .3s var(--snap); }
@keyframes slam { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* "Round 1": a black band slams across, the words slide in fast and settle. */
.call.k-round { animation: none; }
.call.k-round::before { content: ''; position: absolute; left: -4%; right: -4%; top: 50%; height: 1.25em; z-index: -1; background: #0c0a0b; border-block: 6px solid var(--gold); transform: translateY(-50%) skewY(-3deg); animation: band 1.1s var(--out) both; }
.call.k-round.is-final::before { background: var(--blood); border-color: var(--ink); }
.call.k-round .ch { animation: round-letter 1.1s calc(var(--i) * 28ms) var(--out) both; }
@keyframes band { 0% { transform: translateY(-50%) skewY(-3deg) scaleY(0); } 14%, 82% { transform: translateY(-50%) skewY(-3deg) scaleY(1); opacity: 1; } 100% { transform: translateY(-50%) skewY(-3deg) scaleY(.2); opacity: 0; } }
@keyframes round-letter { 0% { transform: translateX(60vw) skewX(-30deg); opacity: 0; filter: blur(6px); } 22% { transform: translateX(-.04em) skewX(6deg); opacity: 1; filter: none; } 30%, 80% { transform: none; opacity: 1; } 100% { transform: translateX(-30vw) skewX(-20deg); opacity: 0; } }
/* 3, 2, 1: each number punches in with a ring thrown out behind it. */
.call.k-count { animation: count-in .75s var(--snap) both; }
.call.k-count::before { content: ''; position: absolute; left: 50%; top: 50%; width: 1.6em; height: 1.6em; margin: -.8em 0 0 -.8em; z-index: -1; border: .07em solid var(--gold); border-radius: 50%; animation: count-ring .75s var(--out) both; }
@keyframes count-in { 0% { transform: scale(2.4); opacity: 0; } 20% { transform: scale(.94); opacity: 1; } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { transform: scale(.85); opacity: 0; } }
@keyframes count-ring { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
/* GAG!: the biggest word in the game. A burst of rays, then the letters keep shaking for the take. */
.call.k-gag { color: var(--red); font-size: clamp(120px, 20vw, 300px); -webkit-text-stroke: 6px #000; animation: gag-in .65s var(--snap) both; }
.call.k-gag::before { content: ''; position: absolute; left: 50%; top: 50%; width: 140vmax; height: 140vmax; margin: -70vmax 0 0 -70vmax; z-index: -1; background: repeating-conic-gradient(rgb(255 197 49 / .5) 0 4deg, transparent 4deg 16deg); mask-image: radial-gradient(closest-side, transparent 10%, #000 30%, transparent 70%); -webkit-mask-image: radial-gradient(closest-side, transparent 10%, #000 30%, transparent 70%); animation: rays .65s var(--out) both; }
.call.k-gag .ch { animation: jitter .09s calc(var(--i) * 30ms) linear infinite; }
@keyframes gag-in { 0% { transform: scale(3.2) rotate(-6deg); opacity: 0; } 25% { transform: scale(.9) rotate(2deg); opacity: 1; } 40% { transform: scale(1.04); } 100% { transform: scale(1); opacity: 1; } }
@keyframes rays { 0% { transform: scale(.3) rotate(0); opacity: 1; } 100% { transform: scale(1.2) rotate(25deg); opacity: 0; } }
@keyframes jitter { 0% { transform: translate(0, 0); } 33% { transform: translate(-3px, 2px); } 66% { transform: translate(3px, -2px); } }
/* TIME: drops in and squashes. */
.call.k-time { animation: time-in .6s var(--snap) both; }
@keyframes time-in { 0% { transform: translateY(-60%) scaleY(1.4); opacity: 0; } 40% { transform: translateY(4%) scaleY(.8) scaleX(1.1); opacity: 1; } 100% { transform: none; } }
/* The judge is thinking: the letters wave. */
.call.k-judging { animation: none; font-size: clamp(44px, 6vw, 90px); }
.call.k-judging .ch { animation: wave 1s calc(var(--i) * 70ms) ease-in-out infinite; }
@keyframes wave { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-.18em); color: var(--gold); } }
/* K.O.: each letter slams separately; the screen strobes (motion.js flash). */
.call.k-ko { color: var(--red); font-size: clamp(150px, 26vw, 380px); -webkit-text-stroke: 8px #000; animation: none; }
.call.k-ko .ch { animation: ko-letter .5s calc(var(--i) * 140ms) var(--snap) both; }
@keyframes ko-letter { 0% { transform: scale(4) rotate(-14deg); opacity: 0; } 50% { transform: scale(.9) rotate(3deg); opacity: 1; } 100% { transform: none; } }
/* PERFECT: letters pop one after another. */
.call.k-perfect { animation: none; }
.call.k-perfect .ch { animation: perfect-letter .45s calc(var(--i) * 45ms) var(--snap) both; }
@keyframes perfect-letter { 0% { transform: translateY(.5em) scale(.3); opacity: 0; } 100% { transform: none; opacity: 1; } }
/* Recording detected / new record: a slapped-on stamp. */
.call.k-stamp { animation: stamp-call .45s var(--snap) both; }
.call.k-stamp > .ch:first-child { margin-left: 0; }
.call.k-stamp.is-red { transform-origin: center; }
@keyframes stamp-call { 0% { transform: scale(2.6) rotate(-14deg); opacity: 0; } 60% { transform: scale(.96) rotate(-4deg); opacity: 1; } 100% { transform: rotate(-5deg); } }
.shake { animation: shake .3s linear; }
.shake-heavy { animation: shake-heavy .55s linear; }
@keyframes shake { 20% { transform: translate(10px, -5px); } 40% { transform: translate(-9px, 6px); } 60% { transform: translate(6px, 4px); } 80% { transform: translate(-4px, -3px); } }
@keyframes shake-heavy { 10% { transform: translate(-18px, 8px) rotate(-.6deg); } 25% { transform: translate(16px, -10px) rotate(.5deg); } 40% { transform: translate(-12px, 6px); } 55% { transform: translate(9px, -4px); } 70% { transform: translate(-5px, 3px); } 85% { transform: translate(3px, -1px); } }

/* ---------- VS intro: the two corners slam together on the diagonal, full screen ---------- */
.intro { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; background: #0c0a0b; animation: intro-bg var(--intro) linear both; }
@keyframes intro-bg { 0% { opacity: 0; } 5%, 90% { opacity: 1; } 100% { opacity: 0; } }
.intro-side { position: absolute; inset: 0; overflow: hidden; }
.intro-you { background: var(--you); clip-path: polygon(0 0, 60% 0, 40% 100%, 0 100%); animation: side-you var(--intro) both; }
.intro-them { background: var(--them); clip-path: polygon(60% 0, 100% 0, 100% 100%, 40% 100%); animation: side-them var(--intro) both; }
@keyframes side-you { 0% { transform: translateX(-70%); animation-timing-function: var(--out); } 13% { transform: translateX(2%); } 18% { transform: none; animation-timing-function: linear; } 86% { transform: translate(-1.5%, 0); animation-timing-function: var(--in); } 100% { transform: translate(-60%, -30%); } }
@keyframes side-them { 0% { transform: translateX(70%); animation-timing-function: var(--out); } 13% { transform: translateX(-2%); } 18% { transform: none; animation-timing-function: linear; } 86% { transform: translate(1.5%, 0); animation-timing-function: var(--in); } 100% { transform: translate(60%, 30%); } }
/* The faces print in the corner colour, like a fight poster. */
.intro-face { position: absolute; top: 0; bottom: 0; width: 62%; overflow: hidden; mix-blend-mode: multiply; filter: grayscale(1) contrast(1.55) brightness(1.4); }
.intro-you .intro-face { left: 0; }
.intro-them .intro-face { right: 0; }
.intro-face canvas, .intro-face img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transform-origin: 50% 30%; animation: face-push var(--intro) linear both; }
.intro-face img { height: 122%; object-position: 50% 0; }   /* Tom's photo: the site mark along its bottom stays out of frame */
@keyframes face-push { from { transform: scale(1.18); } to { transform: scale(1.02); } }
/* Speed lines racing through each half. */
.intro-side::after { content: ''; position: absolute; inset: -20%; background: repeating-linear-gradient(-72deg, transparent 0 46px, rgb(255 255 255 / .16) 46px 49px, transparent 49px 120px); animation: speed .5s linear infinite; }
.intro-them::after { animation-direction: reverse; }
@keyframes speed { to { transform: translate(-120px, 0); } }
.intro-name { position: absolute; z-index: 2; margin: 0; max-width: 44vw; font: 400 clamp(48px, 8vw, 132px)/.86 var(--display); text-transform: uppercase; color: var(--ink); text-shadow: .05em .05em 0 #0c0a0b; }
.intro-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.intro-name small { display: block; margin-top: .14em; font: 400 .3em/1 var(--display); color: var(--gold); text-shadow: .06em .06em 0 #0c0a0b; }
.intro-name small:empty { display: none; }
.intro-you .intro-name { left: 4vw; bottom: 9vh; animation: name-you var(--intro) both; }
.intro-them .intro-name { right: 4vw; top: 9vh; text-align: right; animation: name-them var(--intro) both; }
@keyframes name-you { 0%, 12% { transform: translateX(-60vw) skewX(-20deg); } 24% { transform: translateX(1vw) skewX(4deg); } 30%, 100% { transform: none; } }
@keyframes name-them { 0%, 12% { transform: translateX(60vw) skewX(20deg); } 24% { transform: translateX(-1vw) skewX(-4deg); } 30%, 100% { transform: none; } }
/* The cut: a white line flashes down the diagonal when the halves meet. */
.intro-slash { position: absolute; z-index: 3; left: 50%; top: -10%; width: 14px; height: 120%; margin-left: -7px; background: #fff; transform: skewX(-11.3deg) scaleY(0); animation: intro-slash var(--intro) both; }
@keyframes intro-slash { 0%, 12% { transform: skewX(-11.3deg) scaleY(0); opacity: 1; } 15% { transform: skewX(-11.3deg) scaleY(1); width: 40px; margin-left: -20px; } 26% { width: 8px; margin-left: -4px; } 86% { opacity: 1; transform: skewX(-11.3deg) scaleY(1); } 100% { opacity: 0; } }
.intro-vs { position: absolute; z-index: 4; left: 50%; top: 50%; margin: 0; display: flex; gap: .05em; align-items: flex-start; font: 400 clamp(120px, 17vw, 260px)/1 var(--display); color: var(--gold); -webkit-text-stroke: 7px #000; paint-order: stroke fill; transform: translate(-50%, -50%); filter: drop-shadow(10px 10px 0 #0c0a0b); }
.intro-vs span { display: block; }
.intro-vs span:last-child { margin-top: .14em; }
.intro-vs span:first-child { animation: vs-v var(--intro) both; }
.intro-vs span:last-child { animation: vs-s var(--intro) both; }
@keyframes vs-v { 0%, 14% { transform: translate(-1.2em, -1.4em) scale(3) rotate(-25deg); opacity: 0; } 21% { transform: translate(.04em, .02em) scale(.9) rotate(2deg); opacity: 1; } 26%, 86% { transform: none; opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes vs-s { 0%, 17% { transform: translate(1.2em, 1.4em) scale(3) rotate(25deg); opacity: 0; } 24% { transform: translate(-.04em, -.02em) scale(.9) rotate(-2deg); opacity: 1; } 29%, 86% { transform: none; opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.intro-frame { position: absolute; inset: 0; }
.intro-frame .sparks { left: 50%; top: 50%; z-index: 5; }

/* ---------- ringside ---------- */
.ringside { max-width: 1280px; margin: 16px auto 0; display: grid; justify-items: center; gap: 12px; text-align: center; }
#status { margin: 0; min-height: 1.5em; font-weight: 800; font-size: 18px; }
.training-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.training-bar select { min-height: 44px; padding: 6px 10px; border: 2px solid var(--line); background: var(--panel); }
.step-btn { width: 44px; height: 44px; border: 2px solid var(--line); background: var(--panel); font: 400 26px/1 var(--display); }
#start-btn { min-width: 140px; font: 400 24px/1 var(--display); text-transform: uppercase; }
.record-line { width: 100%; margin: 0; color: var(--muted); font-size: 14px; }
.ring-actions { display: flex; gap: 8px; }
.chat { width: min(640px, 100%); display: grid; gap: 8px; text-align: left; }
#chat-log { max-height: 140px; overflow-y: auto; padding: 8px 12px; background: var(--panel); font-size: 14px; }
#chat-log:empty { display: none; }
#chat-log p { margin: 2px 0; animation: rise .25s var(--out); }
#chat-form { display: flex; gap: 8px; }
#chat-input { flex: 1; min-width: 0; padding: 8px 12px; border: 2px solid var(--line); background: var(--panel); }
/* Report: always in the opponent's corner during a fight with a person. */
.flag-btn { position: absolute; top: 10px; right: 10px; z-index: 5; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 14px 6px 11px; border: 2px solid rgb(255 42 61 / .85); background: rgb(12 10 11 / .78); color: var(--ink); font: 400 19px/1 var(--display); letter-spacing: .03em; text-transform: uppercase; backdrop-filter: blur(4px); transition: background .12s, border-color .12s, transform .12s; }
.flag-btn svg { width: 17px; height: 17px; fill: var(--red); stroke: var(--red); stroke-width: 2; stroke-linejoin: round; }
.flag-btn:hover { background: var(--red); border-color: var(--red); }
.flag-btn:hover svg { fill: var(--ink); stroke: var(--ink); }
.flag-btn:active { transform: translateY(2px); }
.flag-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn-alarm { border-color: var(--red); background: var(--red); color: var(--ink); box-shadow: 5px 5px 0 var(--blood); }
.btn-alarm:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-report { border-color: rgb(255 42 61 / .6); color: var(--red); }

/* ---------- result ---------- */
.result { position: fixed; inset: 0; z-index: 30; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: clamp(18px, 4vh, 44px) 16px 32px; background: var(--bg); text-align: center; isolation: isolate; }
/* Behind a win: gold rays turning slowly. Behind a loss: a dark red floor. */
.result-rays { position: absolute; left: 50%; top: 14vh; z-index: -1; width: 180vmax; height: 180vmax; margin: -90vmax 0 0 -90vmax; pointer-events: none; opacity: 0; background: repeating-conic-gradient(rgb(255 197 49 / .13) 0 6deg, transparent 6deg 18deg); mask-image: radial-gradient(closest-side, #000 10%, transparent 60%); -webkit-mask-image: radial-gradient(closest-side, #000 10%, transparent 60%); }
.result.in[data-outcome="king"] .result-rays { animation: rays-in .8s .2s var(--out) forwards, rays-turn 40s linear infinite; }
.result[data-outcome="choked"] { background: radial-gradient(ellipse 90% 50% at 50% 100%, #3a0b10, transparent 70%), var(--bg); }
@keyframes rays-in { to { opacity: 1; } }
@keyframes rays-turn { to { rotate: 360deg; } }
.confetti { position: fixed; inset: 0; z-index: 31; width: 100%; height: 100%; pointer-events: none; }
.verdict { margin: 0; font: 400 clamp(72px, 11vw, 160px)/.88 var(--display); text-transform: uppercase; color: var(--gold); -webkit-text-stroke: 4px #000; paint-order: stroke fill; filter: drop-shadow(.06em .06em 0 var(--blood)); white-space: nowrap; }
.verdict .ch { display: inline-block; }
.result[data-outcome="choked"] .verdict { color: var(--ink); filter: drop-shadow(.06em .06em 0 #000); }
.result[data-outcome="draw"] .verdict { color: var(--ink); }
.result.in .verdict .ch { animation: verdict-letter .6s calc(.15s + var(--i) * 50ms) var(--snap) both; }
.result.in[data-outcome="choked"] .verdict .ch { animation: verdict-fall .9s calc(.15s + var(--i) * 70ms) cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes verdict-letter { 0% { opacity: 0; transform: translateY(-1em) scale(1.6) rotate(-12deg); } 55% { opacity: 1; transform: translateY(.05em) scaleY(.82) scaleX(1.1); } 100% { transform: none; } }
@keyframes verdict-fall { 0% { opacity: 0; transform: translateY(-1.2em); } 60% { opacity: 1; transform: translateY(.06em) rotate(calc((var(--i) - 3) * 1.5deg)); } 100% { transform: translateY(.04em) rotate(calc((var(--i) - 3) * 1.2deg)); } }
.verdict-line { margin: 0; color: var(--muted); font-weight: 800; font-size: 18px; }
.result.in .verdict-line { animation: rise .5s .65s var(--out) both; }
.cards { display: flex; gap: clamp(14px, 4vw, 48px); justify-content: center; margin: 22px 0 4px; perspective: 1000px; }
.card { position: relative; margin: 0; width: clamp(140px, 24vw, 280px); }
.result.in .card { animation: card-flip .7s .45s var(--out) both; }
.result.in .card-them { animation-delay: .6s; }
@keyframes card-flip { from { opacity: 0; transform: rotateY(-95deg) translateY(30px); } }
.card-shot { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--panel); border: 6px solid var(--you); box-shadow: 8px 8px 0 #000; }
.card-them .card-shot { border-color: var(--them); }
.card-shot canvas, .card-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-shot .no-shot { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--line); font: 400 120px/1 var(--display); }
.card figcaption { margin-top: 12px; font: 400 26px/1 var(--display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.is-king .card-shot { border-color: var(--gold); }
.card.is-king::before { content: ''; position: absolute; z-index: 2; top: -40px; left: 50%; width: 84px; height: 58px; margin-left: -42px; background: var(--gold); clip-path: polygon(6% 91%, 94% 91%, 100% 23%, 73% 50%, 50% 5%, 27% 50%, 0 23%); filter: drop-shadow(4px 4px 0 #000); }
.result.in .card.is-king::before { animation: crown-fall .7s 1.35s var(--snap) both; }
@keyframes crown-fall { 0% { opacity: 0; transform: translateY(-160px) rotate(-30deg); } 55% { opacity: 1; transform: translateY(6px) rotate(6deg); } 75% { transform: translateY(-10px) rotate(-3deg); } 100% { transform: none; } }
.card.is-choked .card-shot { filter: grayscale(1) contrast(1.1) brightness(.85); }
.stamp { position: absolute; z-index: 3; left: 50%; top: 52%; margin: 0; padding: 4px 14px; border: 6px solid; font: 400 clamp(32px, 4.2vw, 56px)/1 var(--display); text-transform: uppercase; white-space: nowrap; background: rgb(12 10 11 / .6); }
.stamp:empty { display: none; }
.stamp.is-king { color: var(--gold); border-color: var(--gold); transform: translate(-50%, -50%) rotate(-7deg); }
.stamp.is-choked { color: var(--red); border-color: var(--red); transform: translate(-50%, -50%) rotate(9deg); }
.result.in .stamp { animation: stamp .4s 1.05s cubic-bezier(.5, 0, .75, 0) both; }
.result.in .card-them .stamp { animation-delay: 1.2s; }
.result.in .card-shot { animation: card-thud .3s 1.45s ease-out; }
.result.in .card-them .card-shot { animation-delay: 1.6s; }
@keyframes stamp { from { opacity: 0; scale: 3.2; } to { opacity: 1; scale: 1; } }
@keyframes card-thud { 30% { transform: translateY(5px) scale(.985); } }
/* The rank after the fight: the rating counts to its new value, a new rank slams in. */
.rank-change { justify-content: center; margin: 6px 0 0; text-align: left; }
.result.in .rank-change { animation: rise .5s 1.5s var(--out) both; }
.rank-change .steps { height: 58px; }
.rank-change .steps li { width: 14px; }
.rank-change .rank-name { font-size: clamp(30px, 5vw, 54px); }
.rank-change .rank-name em { -webkit-text-stroke: 2px #000; paint-order: stroke fill; }
.rank-change .rank-note { font-size: 16px; font-weight: 800; }
.rank-change.is-up .rank-name span { padding: 0 10px; background: var(--gold); color: #140f05; animation: slam .35s var(--snap); }
.rank-change.is-down .rank-name span { color: var(--red); animation: slam .35s var(--snap); }
.rank-change.is-up .rank-note { color: var(--gold); }
.rank-change.is-off .rank-name { color: var(--muted); }
.result-rounds { border-collapse: collapse; min-width: min(440px, 100%); font-weight: 800; }
.result-rounds th, .result-rounds td { padding: 7px 14px; border-bottom: 2px solid var(--line); }
.result-rounds thead th { color: var(--muted); font-size: 14px; }
.result-rounds td { font: 400 26px/1 var(--display); }
.result-rounds td.win { color: var(--gold); }
.result.in .result-rounds tr { animation: rise .4s calc(1.6s + var(--r, 0) * 90ms) var(--out) both; }
.result-rounds tbody tr:nth-child(1) { --r: 1; } .result-rounds tbody tr:nth-child(2) { --r: 2; } .result-rounds tbody tr:nth-child(3) { --r: 3; }
.result-extra { margin: 0; color: var(--muted); font-weight: 600; }
.result.in .result-extra { animation: rise .4s 1.9s var(--out) both; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.result.in .result-actions { animation: rise .45s 2s var(--out) both; }
#again-btn { min-width: 220px; font: 400 28px/1 var(--display); text-transform: uppercase; }

/* ---------- rankings (in the page) ---------- */
#rankings { max-width: 1100px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 56px; }
.rank-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.rank-head h2 { margin: 0; font: 400 56px/1 var(--display); text-transform: uppercase; }
.rank-boards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.board h3 { margin: 0 0 10px; font: 400 28px/1 var(--display); text-transform: uppercase; color: var(--gold); }
.board ol { list-style: none; counter-reset: top; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li { counter-increment: top; display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--panel); }
.board li::before { content: counter(top); width: 1.6em; color: var(--dim); font: 400 24px/1 var(--display); }
.board li span { flex: 1; font-weight: 800; }
.board small { display: block; color: var(--muted); font-weight: 600; }
.board li b { font: 400 30px/1 var(--display); color: var(--gold); }
.board li.empty::before { content: none; }
.board li.empty { color: var(--muted); }
.board-wide { grid-column: 1 / -1; }
.board table { width: 100%; border-collapse: collapse; }
.board th, .board td { padding: 8px 10px; border-bottom: 2px solid var(--line); text-align: left; }
.board thead th { color: var(--muted); font-size: 14px; }
.board-note { color: var(--muted); }
.ladder li:nth-child(-n + 3)::before { color: var(--gold); }
.ladder li.me { box-shadow: inset 6px 0 0 var(--you); }
.ladder small b { font: inherit; color: var(--ink); }

/* ---------- rankings page ---------- */
.rankings-page { width: min(1180px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(14px, 3vw, 32px) 72px; }
.rankings-page .rank-head { padding-bottom: 16px; border-bottom: 4px solid var(--gold); }
.rankings-page h1 { margin: 0; font: 400 clamp(52px, 9vw, 110px)/.86 var(--display); text-transform: uppercase; animation: rise .5s var(--out) both; }
.rankings-page h1 span { color: var(--gold); }
.rankings-intro { color: var(--muted); max-width: 760px; }
.rankings-page #rankings-status { min-height: 1.5em; }
.rankings-periods { display: grid; gap: 30px; }
.rankings-page .board { padding: 0; }
.rankings-page .board h2 { margin: 0 0 14px; color: var(--ink); font: 400 clamp(30px, 4vw, 44px)/1 var(--display); text-transform: uppercase; }
.global-board { list-style: none; counter-reset: none; margin: 0; padding: 0; display: block; columns: 3; column-gap: 12px; }
.global-board li { min-width: 0; display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 8px 10px; break-inside: avoid; background: var(--panel); animation: rise .35s calc(var(--k, 0) * 18ms) var(--out) both; }
.rankings-page .global-board li::before { content: none; }
.global-board .board-place { width: 2em; color: var(--dim); font: 400 18px/1 var(--display); font-variant-numeric: tabular-nums; }
.global-board .board-player { flex: 1; min-width: 0; overflow: hidden; color: var(--ink); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.global-board small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.global-board li b { color: var(--gold); font: 400 24px/1 var(--display); font-variant-numeric: tabular-nums; }
.global-board .podium { border-left: 6px solid var(--line); }
.global-board .podium-1 { border-left-color: var(--gold); background: #2a2114; }
.global-board .podium-1 .board-place { color: var(--gold); }
.global-board .podium-2 { border-left-color: #c9c2b6; }
.global-board .podium-3 { border-left-color: #b4743f; }
.global-board li.empty { color: var(--muted); }

/* ---------- dialogs ---------- */
dialog { width: min(640px, calc(100% - 32px)); padding: 26px; border: 4px solid var(--gold); background: var(--panel); color: var(--ink); box-shadow: 10px 10px 0 #000; }
dialog[open] { animation: dialog-in .35s var(--snap); }
dialog::backdrop { background: rgb(0 0 0 / .82); }
@keyframes dialog-in { from { transform: scale(.85) rotate(-2deg); opacity: 0; } }
dialog h2 { margin: 0 0 12px; font: 400 44px/1 var(--display); text-transform: uppercase; }
dialog p { color: var(--muted); }
dialog strong { color: var(--ink); }
.report-dialog { border-color: var(--red); }
.report-dialog h2 span { color: var(--red); overflow-wrap: anywhere; }
.report-shot { margin: 0 0 14px; }
.report-shot img { display: block; width: 100%; max-height: 38svh; object-fit: contain; background: #000; border: 2px solid var(--line); }
.report-shot figcaption { margin-top: 6px; color: var(--muted); font-size: 13px; }
.report-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; border: 0; }
.report-reasons legend { margin-bottom: 8px; padding: 0; font-weight: 800; }
.report-reasons label { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 2px solid var(--line); font-weight: 700; cursor: pointer; transition: border-color .12s, background .12s; }
.report-reasons label:has(:checked) { border-color: var(--red); background: rgb(255 42 61 / .14); }
.report-reasons input { accent-color: var(--red); width: 18px; height: 18px; margin: 0; flex: none; }
.report-after { margin: 12px 0 14px; font-size: 14px; }
@media (max-width: 560px) { .report-reasons { grid-template-columns: 1fr; } .report-dialog { padding: 18px; } .report-dialog h2 { font-size: 34px; } .report-shot img { max-height: 28svh; } .flag-btn { top: 8px; right: 8px; min-height: 36px; padding: 4px 11px 4px 9px; font-size: 16px; } }
@media (max-height: 620px) { .report-dialog { padding: 16px 18px; } .report-dialog h2 { margin-bottom: 8px; font-size: 32px; } .report-shot img { max-height: 24svh; } .report-reasons label { min-height: 40px; padding: 4px 10px; } .report-after { margin: 8px 0 10px; } }
#rules { max-height: calc(100vh - 40px); }

/* ---------- the wipe between screens, flashes, sparks (motion.js) ---------- */
.wipe { position: fixed; inset: 0; z-index: 100; pointer-events: none; visibility: hidden; overflow: hidden; }
.wipe.is-in { visibility: visible; pointer-events: auto; }
.wipe-bar { position: absolute; top: -10%; bottom: -10%; left: -30%; width: 160%; transform: translateX(-92%) skewX(-16deg); }
.wipe-a { background: var(--you); } .wipe-b { background: var(--gold); } .wipe-c { background: #0c0a0b; }
.wipe[data-tone="home"] .wipe-a { background: var(--them); }
.wipe[data-tone="result"] .wipe-a { background: var(--red); }
.wipe.run-in .wipe-bar { animation: wipe-in .3s cubic-bezier(.65, 0, .35, 1) both; }
.wipe.run-in .wipe-b { animation-delay: .03s; } .wipe.run-in .wipe-c { animation-delay: .06s; }
.wipe.run-out .wipe-bar { transform: none; animation: wipe-out .4s var(--out) both; }
.wipe.run-out .wipe-c { animation-delay: 0s; } .wipe.run-out .wipe-b { animation-delay: .04s; } .wipe.run-out .wipe-a { animation-delay: .08s; }
@keyframes wipe-in { from { transform: translateX(-92%) skewX(-16deg); } to { transform: translateX(0) skewX(-16deg); } }
@keyframes wipe-out { from { transform: translateX(0) skewX(-16deg); } to { transform: translateX(92%) skewX(-16deg); } }
.wipe-mark { position: absolute; left: 50%; top: 50%; width: 120px; height: 82px; margin: -41px 0 0 -60px; opacity: 0; }
.wipe-mark svg { width: 100%; height: 100%; fill: var(--gold); }
.wipe.run-in .wipe-mark { animation: mark-in .24s .2s var(--snap) both; }
.wipe.run-out .wipe-mark { animation: mark-out .2s both; }
@keyframes mark-in { from { opacity: 0; transform: scale(.2) rotate(-40deg); } to { opacity: 1; transform: none; } }
@keyframes mark-out { from { opacity: 1; } to { opacity: 0; transform: scale(1.8); } }
.flash { position: fixed; inset: 0; z-index: 95; pointer-events: none; opacity: 0; background: #fff; }
.flash[data-kind="red"] { background: var(--red); }
.flash[data-kind="gold"] { background: var(--gold); }
.flash[data-kind="blue"] { background: var(--them); }
.flash.go { animation: flash .32s ease-out; }
.flash.go[data-kind="strobe"] { animation: strobe .6s steps(1); }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
@keyframes strobe { 0% { opacity: .9; } 16% { opacity: 0; } 33% { opacity: .7; } 50% { opacity: 0; } 66% { opacity: .5; } 83%, 100% { opacity: 0; } }
.sparks { position: absolute; left: 50%; top: 45%; z-index: 9; width: 0; height: 0; pointer-events: none; }
.sparks i { position: absolute; left: 0; top: -2px; width: var(--w); height: 4px; background: var(--gold); transform-origin: 0 50%; transform: rotate(var(--a)) translateX(0) scaleX(.2); animation: spark .55s var(--out) both; }
.sparks.is-red i { background: var(--red); } .sparks.is-white i { background: #fff; } .sparks.is-blue i { background: var(--them); }
@keyframes spark { 0% { opacity: 1; transform: rotate(var(--a)) translateX(10px) scaleX(1.4); } 100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scaleX(.2); } }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .stage { grid-template-columns: minmax(0, 40fr) minmax(0, 60fr); }
  .wordmark { font-size: clamp(60px, min(11vw, 15svh), 120px); }
}
@media (min-width: 761px) and (max-height: 800px) {
  .wordmark { font-size: clamp(60px, min(10.5vw, 13.5svh), 168px); }
  .stage-inner { padding-block: clamp(14px, 3.4svh, 56px); }
}
@media (min-width: 761px) and (max-height: 640px) {
  .wordmark { font-size: clamp(56px, min(10.5vw, 12svh), 168px); }
  .stage-inner { padding-block: 12px; }
  .mode span { display: none; }
  .match-note { margin-bottom: 10px; }
}
@media (max-width: 760px) {
  .topbar { height: 54px; padding: 0 10px; }
  #notice { top: 54px; }
  .topbar-btn[href="/index.php"] { display: none; }
  .wordmark-small { font-size: 22px; }
  .topbar nav { gap: 0; }
  .topbar-btn { padding: 8px 6px; font-size: 13px; }
  .topbar-btn::after { left: 6px; right: 6px; }
  #home { min-height: calc(100svh - 54px); }
  .stage { display: flex; flex-direction: column; align-items: stretch; }
  .stage-portrait { flex: 1 1 0; height: auto; min-height: clamp(100px, 20svh, 200px); max-height: 360px; clip-path: polygon(0 0, 100% 0, 100% 84%, 0 100%); }
  .stage-portrait::before { clip-path: polygon(0 calc(100% - 12px), 100% calc(84% - 12px), 100% 84%, 0 100%); transform-origin: left; }
  @keyframes slash-in { from { transform: scaleX(0); } }
  @keyframes cut-in { from { clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); } }
  .stage-portrait strong { font-size: clamp(40px, 12vw, 64px); }
  .stage-portrait figcaption { bottom: 14%; }
  .stage-inner { width: 100%; padding: 6px 16px 28px; margin-top: -18px; }
  .wordmark { font-size: clamp(64px, 21vw, 110px); }
  .wordmark > span { display: inline-block; }
  .w-royale { margin-left: .14em; }
  .tagline { margin-top: 14px; font-size: clamp(22px, 6.4vw, 30px); }
  .match-note { margin-bottom: 16px; font-size: 15px; }
  .btn-play { height: 70px; font-size: clamp(28px, 8.4vw, 38px); }
  .btn-voice { height: 64px; font-size: clamp(24px, 7vw, 32px); }
  .check.is-failed .cam-fail { padding-block: 46px; }
  .play-side { flex-wrap: nowrap; gap: 8px; }   /* the count and your name share one line */
  .live { gap: 6px; font-size: 13px; white-space: nowrap; }
  .live-now { display: none; }
  .fighter-name { gap: 6px; font-size: 13px; white-space: nowrap; }
  .fighter-name input { width: 124px; }
  .modes { gap: 8px; margin-top: 16px; }
  .mode { padding: 12px 12px 12px 16px; }
  .mode b { font-size: clamp(20px, 6vw, 26px); }
  .mode span { font-size: 13px; }
  .rank-strip { margin-top: 14px; }
  @media (max-height: 760px) {
    .stage-inner { padding-bottom: 14px; }
    .wordmark { font-size: clamp(56px, min(21vw, 11svh), 110px); }
    .tagline { margin-top: 8px; }
    .match-note { margin-bottom: 10px; }
    .btn-play { height: 58px; }
    .play-row { gap: 8px; }
    .modes, .rank-strip { margin-top: 10px; }
    .mode span { display: none; }   /* short phones: the two titles say enough */
    .stage-portrait { min-height: clamp(76px, 13svh, 200px); }
  }
  .tom-screen { width: 78%; }
  .hud-name { font-size: 18px; }
  .hud-centre { min-width: 78px; padding: 4px 8px; }
  .plate { font-size: 17px; bottom: 8px; }
  .tile-rank { bottom: 41px; padding: 3px 8px 2px 7px; font-size: 13px; }
  .meter { width: 10px; top: 8px; bottom: 8px; }
  .pop { padding-bottom: 40px; }
  .pop-bars { display: none; }
  .rank-boards { grid-template-columns: 1fr; }
  .rank-name { font-size: 24px; }
  .rank-change .steps { height: 46px; }
  .rank-change .steps li { width: 9px; }
  .cards { gap: 14px; }
  .card { width: 42vw; }
  .card figcaption { font-size: 20px; }
  .verdict { font-size: clamp(46px, 15vw, 100px); -webkit-text-stroke-width: 3px; }
  .intro-you { clip-path: polygon(0 0, 100% 0, 100% 40%, 0 60%); }
  .intro-them { clip-path: polygon(0 60%, 100% 40%, 100% 100%, 0 100%); }
  .intro-face { width: 100%; top: 0; bottom: auto; height: 60%; }
  .intro-them .intro-face { top: 40%; bottom: 0; height: 60%; }
  @keyframes side-you { 0% { transform: translateY(-70%); animation-timing-function: var(--out); } 13% { transform: translateY(2%); } 18% { transform: none; animation-timing-function: linear; } 86% { transform: translateY(-1%); animation-timing-function: var(--in); } 100% { transform: translate(-30%, -60%); } }
  @keyframes side-them { 0% { transform: translateY(70%); animation-timing-function: var(--out); } 13% { transform: translateY(-2%); } 18% { transform: none; animation-timing-function: linear; } 86% { transform: translateY(1%); animation-timing-function: var(--in); } 100% { transform: translate(30%, 60%); } }
  .intro-name { max-width: 90vw; font-size: clamp(44px, 14vw, 80px); }
  .intro-you .intro-name { left: 5vw; top: 8vh; bottom: auto; }
  .intro-them .intro-name { right: 5vw; bottom: 8vh; top: auto; }
  .intro-slash { top: 50%; left: -10%; width: 120%; height: 12px; margin: -6px 0 0; transform: skewY(-11.3deg) scaleX(0); }
  @keyframes intro-slash { 0%, 12% { transform: skewY(-11.3deg) scaleX(0); opacity: 1; } 15% { transform: skewY(-11.3deg) scaleX(1); } 86% { opacity: 1; transform: skewY(-11.3deg) scaleX(1); } 100% { opacity: 0; } }
  .intro-vs { font-size: clamp(100px, 30vw, 160px); -webkit-text-stroke: 5px #000; }
  .global-board { columns: 1; }
  .call.k-round::before { border-block-width: 4px; }
}
/* Phones held upright: the opponent above, you below (as in a video call). Held sideways, the corners stay side by side. */
@media (max-width: 760px) and (orientation: portrait) {
  .ring { grid-template-columns: 1fr; grid-template-areas: "them" "you"; gap: 8px; max-width: none; }
  .fighter, [data-mode="tom"] .tom-screen, [data-mode="practice"] .tom-screen { aspect-ratio: 16 / 11; }
  @keyframes knock-you { 15% { transform: translateY(18px) rotate(-1deg) scale(.97); } }
  @keyframes knock-them { 15% { transform: translateY(-18px) rotate(1deg) scale(.97); } }
  @keyframes lunge-you { 30% { transform: translateY(-10px) scale(1.03); } }
  @keyframes lunge-them { 30% { transform: translateY(10px) scale(1.03); } }
}
@media (min-width: 621px) and (max-width: 1000px) { .global-board { columns: 2; } }
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { height: 44px; }
  #home { min-height: calc(100svh - 44px); }
  .stage { display: grid; grid-template-columns: minmax(0, 38fr) minmax(0, 62fr); }   /* phones held sideways: Tom beside the menu */
  .stage-portrait { min-height: 0; max-height: none; height: auto; align-self: stretch; clip-path: polygon(0 0, 100% 0, 84% 100%, 0 100%); }
  .stage-portrait::before { clip-path: polygon(calc(100% - 12px) 0, 100% 0, 84% 100%, calc(84% - 12px) 100%); }
  .stage-portrait strong { font-size: clamp(30px, 6vw, 48px); }
  .stage-inner { width: 100%; margin-top: 0; padding: 5px 20px; }
  .wordmark { font-size: clamp(40px, 14svh, 64px); }
  .wordmark > span { display: inline-block; }
  .w-royale { margin-left: .14em; }
  .tagline { margin-top: 4px; font-size: 22px; }
  .match-note { margin-bottom: 6px; font-size: 13px; }
  .btn-play { height: 50px; font-size: 28px; }
  .play-row { gap: 6px; }
  .rank-strip { margin-top: 8px; padding-block: 6px; }
  .rank-note { display: none; }
  .play-side { flex-wrap: nowrap; gap: 8px; }
  .live { font-size: 12px; white-space: nowrap; }
  .live-now { display: none; }
  .live b { font-size: 18px; }
  .fighter-name { gap: 6px; font-size: 12px; white-space: nowrap; }
  .fighter-name input { width: 116px; padding: 5px 8px; font-size: 16px; }
  .modes { margin-top: 8px; }
  .mode { padding: 8px 12px; }
  .mode b { font-size: 22px; }
  .mode span { display: none; }
  #arena { padding-top: 6px; }
  .hud { margin-bottom: 6px; }
  .ring { max-width: min(1280px, (100vh - 150px) * 2.75); gap: 8px; }
}
@media (max-width: 380px) {
  .wordmark-small { font-size: 19px; }
  .topbar-btn { padding-inline: 4px; font-size: 12px; }
  .fighter-name input { width: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  body::before { animation: none; }
}

/* ?camtest: what the browser says about the camera (for the site owner) */
#cam-report { position: fixed; left: 8px; bottom: 8px; z-index: 50; pointer-events: none; opacity: .92; max-width: calc(100vw - 16px); margin: 0; padding: 8px 10px; background: #000; color: #fff; border: 1px solid var(--gold); font: 12px/1.4 ui-monospace, monospace; white-space: pre-wrap; }

/* Voice only (no camera): the player's corner says so instead of showing black. */
.no-camera video, .no-camera canvas { visibility: hidden; }
/* Voice only, either side: a stand-in face fills the corner, waiting, then gagging while the voice is loud (arena.js standIns). */
.stand-in { position: absolute; inset: 0; z-index: 1; display: none; background: #000; pointer-events: none; }
.no-camera .stand-in, .fighter-them.voice-only .stand-in { display: block; }
.check.is-failed .stand-in { display: none; }
.stand-in img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transition: transform .14s var(--snap); }
.stand-in img:nth-child(2) { opacity: 0; }
.stand-in.is-gagging img { transform: scale(1.07) rotate(-1deg); }
.stand-in.is-gagging img:nth-child(2) { opacity: 1; }
.stand-in small { position: absolute; top: 14px; left: 16px; padding: 4px 10px 3px; background: rgb(12 10 11 / .82); color: var(--ink); font: 400 18px/1 var(--display); text-transform: uppercase; }
.fighter-them .stand-in small { left: 38px; }   /* clear of the meter on the left and Report on the right */
.mirror .stand-in small, .is-recording .stand-in small { display: none; }

/* ---------- accounts (guests only: account.js) ---------- */
.topbar-account { color: var(--gold); }
.rank-strip:has(.rank-save) { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "steps name save" "steps note note"; }
/* One line beside the rank: the note under it keeps the full width, so the strip is no taller. */
.rank-save { grid-area: save; align-self: end; display: flex; align-items: baseline; gap: 8px; padding: 0; border: 0; background: none; color: var(--muted); white-space: nowrap; }
.rank-save span { font-size: 12px; font-weight: 600; }
.rank-save b { font: 400 20px/1 var(--display); text-transform: uppercase; color: var(--gold); border-bottom: 2px solid currentColor; transition: color .15s; }
.rank-save:hover b { color: var(--ink); }
.result-save { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; max-width: 620px; padding: 10px 14px; background: var(--panel); border-left: 6px solid var(--gold); }
.result-save p { margin: 0 6px 0 0; color: var(--muted); font-size: 14px; }
.result-save strong { color: var(--ink); }
.result.in .result-save { animation: rise .45s 1.8s var(--out) both; }
.account-dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100svh - 32px); overflow-y: auto; }
.account-lede { margin: 0 0 16px; font-size: 15px; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.account-tabs button { position: relative; padding: 10px 6px; border: 0; background: none; color: var(--muted); font: 400 22px/1 var(--display); text-transform: uppercase; }
.account-tabs button::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 4px; background: var(--gold); transform: scaleX(0); transition: transform .2s var(--out); }
.account-tabs button[aria-selected="true"] { color: var(--ink); }
.account-tabs button[aria-selected="true"]::after { transform: scaleX(1); }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; border-color: #fff; background: #fff; color: #1f1f1f; }
.google-btn:hover:not(:disabled) { background: var(--gold); border-color: var(--gold); color: #140f05; }
.google-btn svg { width: 20px; height: 20px; flex: none; }
.account-or { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 13px; font-weight: 700; }
.account-or::before, .account-or::after { content: ''; flex: 1; height: 2px; background: var(--line); }
.account-form { display: grid; gap: 12px; }
.account-form[hidden], .account-form .field[hidden], .account-row[hidden] { display: none; }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; font-weight: 800; color: var(--ink); }
.field input { width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: 600 16px/1.2 inherit; font-family: inherit; transition: border-color .15s; }
.field input:focus { border-color: var(--gold); outline: 0; }
.account-hint { margin: 0; font-size: 13px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.account-check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; cursor: pointer; }
.account-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--gold); }
.account-link { padding: 4px 0; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.account-link:hover { color: var(--ink); }
.account-status { min-height: 1.4em; margin: 0; font-size: 14px; font-weight: 700; }
.account-status.is-bad { color: var(--red); }
.account-sent p { margin: 0 0 16px; color: var(--ink); font-size: 16px; }
@media (max-width: 560px) {
  .account-dialog { padding: 18px; }
  .account-dialog h2 { font-size: 34px; }
  .account-lede { margin-bottom: 12px; font-size: 14px; }
  .account-tabs { margin-bottom: 12px; }
  .account-tabs button { padding-inline: 2px; font-size: 20px; white-space: nowrap; }
  .account-or { margin: 8px 0; }
  .account-form { gap: 10px; }
  .field input { min-height: 44px; }
  .rank-save span, .topbar-account { display: none; }
}
@media (max-height: 620px) { .account-dialog { padding: 16px 18px; } .account-dialog h2 { margin-bottom: 6px; font-size: 32px; } .account-lede { margin-bottom: 10px; font-size: 14px; } }
