*{box-sizing:border-box} [hidden]{display:none!important}
:root{color-scheme:dark;--paper:#fff0cf;--gold:#edb665;--night:#101116;--red:#fa7067;--blue:#80b9ff}
body{margin:0;background:#17191f radial-gradient(ellipse at 50% 0%,#38313b,transparent 70%);color:var(--paper);font:16px system-ui,sans-serif}
main{max-width:1210px;margin:auto;padding:20px 24px 34px}
header,.brand,.utility,.selecthead,.fightrow,.footer{display:flex;align-items:center;gap:14px}header,.selecthead,.fightrow{justify-content:space-between}
header{margin-bottom:16px}.brand img{width:96px;height:96px;object-fit:contain}.brand p,.eyebrow,.selecthead label{color:var(--gold);font-size:.75rem;font-weight:850;letter-spacing:.15em;margin:0}
h1,h2,h3,.subtitle{font-family:Impact,'Arial Black',sans-serif;letter-spacing:.045em;margin:0}h1{font-size:clamp(1.35rem,4vw,3rem);line-height:1.05}.subtitle{font-size:clamp(1rem,2.4vw,1.65rem);margin-top:3px}.subtitle b,.matchup b,.red-title{color:var(--red)}.subtitle strong,.matchup strong,.blue-title{color:var(--blue)}.subtitle span{font-size:.75em}
button,select{font:inherit;font-weight:750;background:#212229;color:var(--paper);border:1px solid #5b5260;border-radius:5px;padding:8px 12px;cursor:pointer}button:hover{border-color:var(--gold)}button:focus-visible,select:focus-visible,summary:focus-visible,a:focus-visible{outline:2px solid var(--gold);outline-offset:3px}.gold{background:var(--gold);color:#171211;border-color:#ffd89c;padding:10px 20px;font-weight:900}
#cabinet{position:relative;overflow:hidden;border:1px solid #816244;border-radius:7px;background:#151622;box-shadow:0 15px 45px #0008;isolation:isolate}
canvas{width:100%;height:auto;display:block}
#start,#results{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;background:radial-gradient(ellipse,#141222db,#10121747 70%,#17101884);padding:10px}
#start h2,#results h2{font-size:clamp(1.65rem,7vw,5.5rem);text-shadow:3px 4px #27161a,0 5px 18px #000;line-height:1.05}.matchup{font-weight:900;text-transform:uppercase;letter-spacing:.12em;margin:0 0 8px;font-size:clamp(.85rem,2.5vw,1.5rem)}
#hud{position:absolute;top:6%;left:4%;right:4%;display:grid;grid-template-columns:1fr auto 1fr;gap:2%;align-items:start;pointer-events:none}
.health>div:first-child{display:flex;justify-content:space-between;gap:3px;text-shadow:1px 2px #000;font-size:clamp(.58rem,2vw,1.15rem);line-height:1.1;text-transform:uppercase;margin-bottom:4px}.blue>div:first-child{flex-direction:row-reverse}.health span{color:var(--gold)}
.gauge{height:clamp(8px,2vw,20px);border:2px solid #f7e0b7;background:#190e13;box-shadow:2px 3px #000}.power{height:5px;background:#151321;border:1px solid #c49b75;margin-top:4px}.gauge i,.power i{height:100%;display:block;transition:width .13s linear}.red i{background:linear-gradient(#ffa67d,#d33e53)}.blue i{background:linear-gradient(#addfff,#3975da);margin-left:auto}.power i{background:var(--gold)}
#clock{font-family:Impact,sans-serif;font-size:clamp(1.25rem,4vw,3rem);background:#19161d;border:1px solid var(--gold);min-width:1.45em;text-align:center;padding:0 .1em}
#announcement{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none;text-align:center;font:clamp(1.2rem,5vw,4rem) Impact,sans-serif;text-transform:uppercase;color:#ffe6a2;text-shadow:2px 2px #632538,4px 4px black;padding:10%}
#select{margin-top:24px;background:#121318;border:1px solid #51434a;border-radius:8px;padding:16px}.selecthead label{white-space:nowrap}.teams{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:13px 0}.teams h3{font-size:1rem;margin-bottom:6px}.roster{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}.tile{display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:4px 2px 6px;min-width:0;font-size:clamp(.64rem,1.15vw,.84rem);line-height:1.1;min-height:100%;background:radial-gradient(ellipse at 48% 40%,#57333e,#211b26 75%)}#blue .tile{background:radial-gradient(ellipse at 48% 40%,#304e65,#17202c 75%)}.tile img{width:100%;height:clamp(44px,6vw,78px);object-fit:contain;object-position:bottom;display:block}.tile span{min-height:2.15em;display:grid;place-items:center}.tile[aria-pressed=true]{border-color:var(--gold);box-shadow:inset 0 0 0 1px var(--gold);color:#ffe398}.fightrow{border-top:1px solid #4b414b;padding-top:13px;font-size:.85rem}.fightrow button{flex-shrink:0}.footer{flex-wrap:wrap;margin-top:15px;color:#d2bca6;font-size:.85rem}.footer a{color:var(--gold);margin-left:auto}.footer summary{cursor:pointer}#controls{margin:8px 0;line-height:1.7}
@media(max-width:680px){main{padding:10px}.brand img{width:53px;height:53px}.utility{gap:4px}.utility button{font-size:.68rem;padding:6px}.teams{grid-template-columns:1fr}.tile img{height:62px}.tile{font-size:.71rem}.selecthead h2{font-size:1.2rem}#select{padding:10px}.fightrow .gold{padding:8px}.footer{gap:8px}}
.selecthead{flex-wrap:wrap}.selecthead label{letter-spacing:.04em}.selecthead select{max-width:54vw}.reserve{font-size:.8em;color:#ffe2a4}
.fightrow{flex-wrap:wrap}.fightrow #selection{flex:1;min-width:14ch}
.start-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:center}
@media(max-width:430px){#start{gap:5px}.start-actions button{padding:6px 8px;font-size:.75rem}.matchup{margin-bottom:3px}}

/* Site links above the game header */
.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 12px;
    padding: 0 0 7px;
    border-bottom: 1px solid #51434a;
}
.site-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 5px 9px;
    border-radius: 5px;
    color: var(--gold);
    font-size: .88rem;
    font-weight: 750;
    text-decoration: none;
}
.site-nav a:hover {
    background: #25202a;
    text-decoration: underline;
}

/* Touch controls float over the stage and leave its center clear. */
#touch {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 2;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}
@media (any-pointer: coarse) {
    #touch { display: block; }
}
#joystick, .touch-actions button {
    pointer-events: auto;
    touch-action: none;
    -webkit-touch-callout: none;
}
#joystick {
    position: absolute;
    bottom: clamp(7px, 3%, 20px);
    left: clamp(7px, 3%, 22px);
    width: clamp(74px, 21vw, 124px);
    aspect-ratio: 1;
    border: 1px solid #edb665ba;
    border-radius: 50%;
    background: repeating-radial-gradient(circle, transparent 0 23%, #edb66530 24% 25%, transparent 26% 45%), #151521aa;
    box-shadow: inset 0 0 16px #0009, 0 3px 12px #0006;
}
.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 43%;
    aspect-ratio: 1;
    border: 1px solid #ffe1a7;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 29%, #fae3a2dd, #a87542dd 72%);
    box-shadow: 0 3px 9px #0009;
    transform: translate(-50%, -50%) translate(var(--stick-x, 0px), var(--stick-y, 0px));
    pointer-events: none;
}
.touch-actions {
    position: absolute;
    right: clamp(7px, 3%, 22px);
    bottom: clamp(7px, 3%, 20px);
    display: grid;
    grid-template-columns: repeat(4, clamp(44px, 11vw, 60px));
    gap: clamp(4px, 1vw, 8px);
}
.touch-actions button {
    min-height: 44px;
    aspect-ratio: 1;
    padding: 2px;
    border: 1px solid #edb665b5;
    border-radius: 50%;
    background: #181621c7;
    box-shadow: 0 2px 6px #0008;
    color: var(--paper);
    font-size: clamp(.56rem, 2.1vw, .75rem);
    line-height: 1.05;
    text-shadow: 0 1px 2px #000;
}
.touch-actions [data-action="special"] { color: #ffdb93; }
.touch-actions [data-action="block"] { color: #c4ddff; }
.touch-actions button.active { background: #805839; border-color: #fff0cf; }
#touch:not(.tag) [data-action="tag"] { display: none; }

/* Keep touchscreen gestures inside the live fight. */
#cabinet.is-playing,
#cabinet.is-full {
    touch-action: none;
    overscroll-behavior: none;
    -webkit-touch-callout: none;
}
#arena-full {
    position: absolute;
    right: 6px;
    top: 4px;
    z-index: 4;
    min-height: 32px;
    padding: 4px 8px;
    font-size: .73rem;
    background: #181621e8;
}
#cabinet:has(#arena-full:not([hidden])) #hud {
    top: max(6%, 40px);
}
body.arena-full-page { overflow: hidden; overscroll-behavior: none; }
#cabinet.is-full {
    position: fixed;
    inset: 0;
    z-index: 999;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #090910;
    box-shadow: none;
}
body.arena-full-page #cabinet.is-full {
    inset: auto;
    left: var(--arena-left, 0px);
    top: var(--arena-top, 0px);
    width: var(--arena-width, 100vw);
    height: var(--arena-height, 100dvh);
}
#cabinet.is-full canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--fight-width, 100%);
    height: var(--fight-height, auto);
    max-width: 100%;
    max-height: 100%;
    transform: translate(-50%, -50%);
}
#cabinet.is-full #arena-full {
    top: calc(5px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    min-height: 40px;
}
#cabinet.is-full #hud {
    top: max(6%, calc(51px + env(safe-area-inset-top)));
    left: max(4%, calc(8px + env(safe-area-inset-left)));
    right: max(4%, calc(8px + env(safe-area-inset-right)));
}
#cabinet.is-full #joystick {
    left: calc(12px + env(safe-area-inset-left));
    bottom: calc(12px + env(safe-area-inset-bottom));
}
#cabinet.is-full .touch-actions {
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
}
