*{box-sizing:border-box} :root{--ink:#112e34;--paper:#fff4d6;--sun:#ffcc40;--warm:#ff764c;font:600 clamp(14px,2.1vmin,20px) Nunito,"Microsoft YaHei",sans-serif;color:var(--paper)}body{margin:0;background:var(--ink)}#shell{position:relative;isolation:isolate;width:100%;height:100%;overflow:hidden;background:#294d50}button,input{font:inherit}button{background:var(--paper);color:var(--ink);border:2px solid var(--ink);border-radius:5px;padding:.65em 1em;font-weight:900;cursor:pointer;touch-action:manipulation}button:hover{filter:brightness(1.07)}button:active{transform:translateY(2px)}button:focus-visible,input:focus-visible{outline:3px solid #ff8446;outline-offset:2px}button:disabled{opacity:.55;cursor:default}[hidden]{display:none!important}.scenery{position:absolute;inset:0;z-index:-2;background:linear-gradient(0deg,#0e2528bf,transparent 45%),url("assets/valley.png") center 48%/cover,#438583}.scenery:after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 50%,#092a31a8)}header{position:absolute;z-index:4;top:max(2.3cqh,var(--safe-top));left:var(--edge);right:var(--edge);display:flex;gap:.8em;align-items:center;text-shadow:0 1px 4px #10272b}header b{font-weight:1000;font-style:italic}header span{font-size:.82em;border-left:1px solid currentColor;padding-left:1em}#full{margin-left:0}#sound{margin-left:auto;font-size:12px;min-width:44px}header button{min-width:42px;min-height:38px;background:#10343cde;color:white;border:1px solid #ffffff7a;font-size:1.5em;line-height:1;padding:.2em .45em}section{position:absolute;inset:0}.splash{display:flex;align-items:flex-end;justify-content:space-between;padding:0 6cqw max(10cqh,var(--safe-bottom))}.title h1,.title h2{font-size:clamp(56px,10cqw,160px);font-weight:1000;line-height:1;margin:0;letter-spacing:-.045em;color:#fff6d7;transform:skew(-9deg) rotate(-5deg);-webkit-text-stroke:1.5px #142c30;text-shadow:3px 4px #152d33,5px 7px #152d33,7px 10px #ec633f}.title{padding-bottom:2cqh}.menu{width:min(30cqw,370px);display:grid;gap:1.5cqh;align-self:center}.menu button{text-align:left;font-size:clamp(20px,3cqw,42px);padding:.53em .78em;box-shadow:4px 5px 0 #0b262c;transform:skew(-5deg);display:flex;justify-content:space-between;align-items:center}.menu i{font-weight:500}.heroBtn,.accent{background:var(--sun)}h2,p{margin:0}h2{font-weight:1000;font-size:clamp(22px,5.8cqh,60px)}.dialogScene,.versus{display:flex;justify-content:center;align-items:center;background:#112e349b;padding:11cqh var(--edge) 3cqh}.dialogScene article,.dialogScene form{background:var(--paper);color:var(--ink);border:3px solid var(--ink);border-radius:8px;box-shadow:6px 7px #102c32;padding:clamp(15px,4cqh,42px)}form{display:grid;gap:1.7cqh;width:min(350px,70cqw)}input{padding:.5em;border:2px solid #345052;border-radius:4px;letter-spacing:.3em}#invite{display:block;font:900 clamp(32px,8cqh,70px) 'Arial Black',sans-serif;letter-spacing:.12em}.room{width:min(82cqw,850px);display:grid;grid-template-columns:1.2fr 1fr;gap:4cqw;align-items:center}.seats{display:grid;gap:1.8cqh}.seats p{border-bottom:1px solid #a3afa5;padding-bottom:.45em}.versus{gap:6cqw;font-size:1.3em;text-align:center}.versus b{font:bold italic 16cqh 'Arial Black',sans-serif;color:var(--sun)}.versus canvas{width:20cqw;height:34cqh;object-fit:contain}#stage{display:block;width:100%;height:100%}.hud{position:absolute;top:max(2.5cqh,var(--safe-top));left:var(--edge);right:var(--edge);display:grid;grid-template-columns:1fr auto 1fr;gap:3cqw;align-items:start;color:white;text-shadow:1px 2px 2px #153339}.hud>div:last-child{text-align:right}.hp{display:block;background:#132d33;border:2px solid #112e34;border-radius:4px;height:2.6cqh;margin:.3cqh 0;overflow:hidden}.hp i{display:block;height:100%;background:#ffca44}.hud>div:last-child i{margin-left:auto;background:#ff8257}.hud small{font-size:.78em}.hud strong{background:var(--ink);padding:.12em .5em;color:var(--paper);font:bold 6cqh 'Arial Black',sans-serif}#cue{position:absolute;top:29%;width:100%;text-align:center;font-style:italic;font-weight:1000;font-size:7cqh;color:#fff4c7;text-shadow:2px 3px #26444a}#stick,#skills button{touch-action:none;user-select:none;-webkit-user-select:none}#stick{position:absolute;left:var(--edge);bottom:max(6cqh,var(--safe-bottom));width:clamp(80px,22cqh,152px);aspect-ratio:1;border-radius:50%;border:2px solid #fff8;background:#18373c80;display:grid;place-items:center}#stick span{width:45%;aspect-ratio:1;border:2px solid #fff9;border-radius:50%;background:#263b40c7}#skills{position:absolute;right:var(--edge);bottom:max(3cqh,var(--safe-bottom));display:grid;grid-template-areas:"escape ult" "ranged melee";gap:7px}
#skills button{border-radius:50%;width:clamp(45px,15cqh,94px);aspect-ratio:1;padding:0;color:#fff;background:#19383fe8;border:2px solid #fff5c9;font-size:.92em;line-height:1.1}
#skills small{display:block;font-size:.72em}
#skills [data-action=melee]{grid-area:melee;background:var(--sun);color:var(--ink)}
#skills [data-action=ranged]{grid-area:ranged}
#skills [data-action=ult]{grid-area:ult;background:#933f2e}
#skills [data-action=escape]{grid-area:escape}

.versus {
  overflow:hidden;
  background:linear-gradient(105deg,#102d35e8 10%,#14252abb 50%,#342321ed 94%);
}
.versus-lineup {
  width:min(100%,1240px);
  display:grid;
  grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
  align-items:center;
  gap:clamp(6px,1.8cqw,26px);
}
.versus .versus-lineup>b {
  position:relative;
  z-index:1;
  font-size:clamp(26px,7cqw,98px);
  line-height:1;
  color:#ffdc7e;
  text-shadow:0 3px 12px #100e0be0;
  animation:versus-mark .34s .23s ease-out both;
}
.versus-team {
  --team-accent:#9aeed7;
  --team-panel:#18565bbf;
  --entry-x:-100%;
  position:relative;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:clamp(3px,1cqw,14px);
  padding:0 clamp(5px,1cqw,16px) clamp(8px,2cqh,24px);
  background:linear-gradient(0deg,var(--team-panel),transparent 95%);
  border-bottom:3px solid var(--team-accent);
  animation:versus-slide .58s cubic-bezier(.16,1,.3,1) both;
}
#v1 {--team-accent:#ffc09d;--team-panel:#783b2cc4;--entry-x:100%;animation-delay:.06s}
.versus-team h2 {
  grid-column:1/-1;
  font-size:clamp(12px,3.8cqh,32px);
  color:var(--team-accent);
  text-align:start;
  padding-inline:.18em;
}
#v1 h2 {text-align:end}
.versus-team figure {margin:0;min-width:0}
.versus-team canvas {
  display:block;
  width:100%;
  height:auto;
  max-height:min(38cqh,268px);
  object-position:center bottom;
  filter:drop-shadow(0 6px 8px #101b1a85);
}
#v0 canvas {transform:scaleX(-1)}
.versus-team figcaption {
  font-size:clamp(10px,1.8cqw,24px);
  font-weight:900;
  line-height:1.25;
  padding-block:.36em 0;
  border-top:1px solid var(--fighter-color);
  overflow-wrap:anywhere;
}
.versus-team figcaption small {display:block;color:var(--team-accent);font-size:.75em;margin-bottom:.16em}
@keyframes versus-slide {from{transform:translateX(var(--entry-x));opacity:.2}to{transform:translateX(0);opacity:1}}
@keyframes versus-mark {from{opacity:0;transform:scale(1.28)}to{opacity:1;transform:scale(1)}}
#cue[data-kind=start] {
  top:34%;
  color:#ffdc7e;
  font-size:clamp(36px,12cqh,100px);
  line-height:1.1;
  text-shadow:0 3px 5px #172d30,0 0 22px #10292b;
  animation:versus-mark .24s cubic-bezier(.16,1,.3,1) both;
}
#skills {grid-template-areas:"parry escape ult" ". ranged melee"}
#skills [data-action=parry] {grid-area:parry;background:#165a61;border-color:#b5f5e4}
#skills [data-action=parry].cooling::after {background:conic-gradient(#b5f5e4 var(--remaining),transparent 0)}
@media (prefers-reduced-motion:reduce) {
  .versus-team,.versus .versus-lineup>b,#cue[data-kind=start] {animation:none}
}
.result{text-align:center}.result p{margin:2cqh 0}.battleHeader{pointer-events:none;top:auto;bottom:2cqh;justify-content:center}.battleHeader>*{display:none}.battleHeader #back,.battleHeader #sound{display:block;pointer-events:auto;font-size:12px;min-height:28px}.battleHeader #sound{margin-left:0}#notice{position:absolute;bottom:max(2cqh,var(--safe-bottom));left:50%;transform:translateX(-50%);z-index:5;background:var(--ink);border:1px solid #c3d4c9;padding:.45em .9em;border-radius:5px;text-align:center;max-width:85%}
.splash .mascot{position:absolute;left:7cqw;bottom:14cqh;width:38cqw;height:67cqh;object-fit:contain;transform:scaleX(-1) rotate(-3deg);filter:drop-shadow(8px 10px 4px #123a3f66);pointer-events:none}.splash .title,.splash .menu{position:relative}.scenery:after{background:linear-gradient(90deg,#124f5f12 42%,#0b273476 100%)}

.draft {
  display:grid;
  grid-template-columns:minmax(0, 32%) minmax(0, 1fr);
  gap:clamp(12px, 2.6cqw, 34px);
  align-items:center;
  padding:max(62px, 15cqh) var(--edge) max(12px, var(--safe-bottom));
  background:linear-gradient(115deg,#153c42e8,#075956ed);
}
.fighter-frame {
  margin:0;
  overflow:hidden;
  align-self:stretch;
  min-height:0;
  display:grid;
  grid-template-rows:minmax(0, 1fr) auto;
  border:2px solid #eed38b;
  border-radius:8px;
  background:radial-gradient(ellipse at 50% 62%,#588d78 0%,#285758 75%);
  box-shadow:5px 6px #102c32;
}
.fighter-art {
  min-height:0;
  display:grid;
  place-items:end center;
  padding:12px 7px 4px;
}
.fighter-art canvas {
  width:100%;
  height:100%;
  min-height:0;
  object-fit:contain;
  object-position:center bottom;
  filter:drop-shadow(6px 5px 5px #133c3d99);
}
.fighter-frame figcaption {
  padding:8px 12px 10px;
  background:#143c42;
  border-top:1px solid #eed38b8c;
}
.fighter-frame h2 {font-size:clamp(17px, 5cqh, 36px);line-height:1.18}
.fighter-frame p {margin-top:4px;font-size:clamp(11px, 2.9cqh, 17px);color:#f9e5b5}
.draft-panel {
  display:grid;
  gap:clamp(5px, 1.5cqh, 14px);
  align-self:stretch;
  align-content:space-between;
  min-height:0;
  padding:clamp(8px, 2cqh, 26px) clamp(10px, 2cqw, 26px);
  color:var(--ink);
  background:var(--paper);
  border:2px solid #102c32;
  border-radius:8px;
  box-shadow:5px 6px #102c32;
}
.draft-heading {display:flex;justify-content:space-between;align-items:center;gap:8px}
.draft-panel h2 {font-size:clamp(19px, 4.5cqh, 34px);line-height:1}
#choices, #skillTabs, #slots {display:grid;gap:clamp(4px, 1cqw, 10px)}
#choices {grid-template-columns:repeat(5, minmax(0, 1fr));gap:4px clamp(4px, .85cqw, 10px)}
#choices button {font-size:clamp(11px,1.85cqw,18px)}
#skillTabs {grid-template-columns:repeat(5, minmax(0, 1fr))}
#slots {grid-template-columns:repeat(3, minmax(0, 1fr))}
#choices button,#skillTabs button,#slots button {
  min-width:0;
  padding:4px 2px;
  line-height:1.2;
  white-space:nowrap;
}
#choices button {
  border-width:1px 1px 3px;
  border-bottom-color:var(--fighter-color,#548778);
  background:#ffedc3;
}
#choices button.chosen {background:#f9dda1}
#choices button[aria-pressed=true] {background:var(--sun);box-shadow:inset 0 0 0 1px #1b3d41}
#choices canvas {display:block;width:100%;height:clamp(20px, 7cqh, 75px);object-fit:contain}
#skillTabs button {min-height:36px;border:1px solid #c9af7c;background:#f6e5bb}
#skillTabs button[aria-pressed=true] {color:#fff4d6;background:#18565b;border-color:#18565b}
#skillDetail {
  margin-top:5px;
  padding:6px 8px;
  display:grid;
  align-content:center;
  gap:3px;
  height:clamp(66px, 18cqh, 98px);
  background:#f6e7c5;
  border-left:3px solid #1c6165;
  font-size:clamp(11px, 3.3cqh, 16px);
  line-height:1.25;
}
#skillTitle {color:#184e54;font-size:1.12em;line-height:1.16}
#skillStats {color:#245b5d;font-weight:700}
#skills button.cooling {filter:saturate(.7)}
#skills button.charged {box-shadow:0 0 0 2px #fccb52,0 0 12px #fccb5280}
.draft-footer {
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  align-items:stretch;
  gap:clamp(5px, 1cqw, 14px);
}
#slots button {min-height:42px;border-width:1px}
#slots small {display:block;color:#4a625d;font-size:.76em}
#slots .selected {border-color:#a2621e;box-shadow:inset 0 0 0 1px #a2621e}
.draft-footer .accent {padding:4px .65em}
@container game (orientation:landscape) and (max-height:349px){
  .draft {padding-top:52px}
  .draft-panel {gap:5px;padding-top:8px;padding-bottom:8px}
  #choices canvas {height:19px}
  #skillTabs button {min-height:30px}
  #skillDetail {height:62px;padding-top:4px;padding-bottom:4px}
}

@container game (orientation:landscape) and (max-height:410px){
  .draft {padding-top:max(51px, 13cqh);padding-bottom:7px}
  .draft-panel {gap:4px;padding-top:7px;padding-bottom:7px}
  #choices button {font-size:clamp(10px, 1.7cqw, 14px);padding:1px 2px 2px}
  #choices canvas {height:clamp(17px, 6cqh, 25px)}
  #skillTabs button {min-height:28px}
  #skillDetail {margin-top:3px;height:59px;padding:4px 6px;gap:2px}
  #slots button {min-height:34px}
}
@container game (orientation:landscape) and (max-height:345px){
  .draft-panel h2 {font-size:16px}
  #choices canvas {height:16px}
  #choices {row-gap:2px}
  #skillDetail {height:51px;font-size:10px;gap:1px}
  #skillTabs button {min-height:25px}
}

/* Battle HUD: show current health immediately, then let the damage trail catch up. */
.hp {position:relative}
.hp i,.hp em {position:absolute;inset:0;transform:scaleX(var(--hp-ratio,1));transform-origin:left}
.hp em {background:#fff1ca;transition:transform .32s .11s ease-out}
.hp i {transition:transform .09s ease-out}
.hud>div:last-child .hp i,.hud>div:last-child .hp em {transform-origin:right}
.hp[data-reset] i,.hp[data-reset] em {transition:none}
.hp[data-low] i,.hud>div:last-child .hp[data-low] i {background:#f25c4f}
#timer[data-urgent] {background:#823525;color:#fff6d0}
#cue {pointer-events:none}
#cue[data-kind=move] {top:17%;font-size:clamp(19px, 5.2cqh, 42px);text-shadow:1px 2px #263139,0 0 12px #263139}
#skills button {position:relative;isolation:isolate;transition:transform .08s,filter .1s}
#skills button.pressing {transform:scale(.94);filter:brightness(1.13)}
#skills button.cooling::after {
  content:"";position:absolute;inset:-3px;border-radius:50%;padding:2px;pointer-events:none;
  background:conic-gradient(#ffd883 var(--remaining),transparent 0);
  mask:linear-gradient(#fff 0 0) content-box exclude,linear-gradient(#fff 0 0);
}
@media (prefers-reduced-motion:reduce){
  .hp i,.hp em,#skills button {transition:none}
}

#connectionState {
  position:absolute;z-index:6;left:50%;bottom:max(54px,14cqh);transform:translateX(-50%);
  display:flex;align-items:center;gap:9px;padding:7px 9px 7px 11px;
  max-width:calc(100% - 24px);width:max-content;border:1px solid #ebd391;
  border-radius:6px;background:#14383e;color:#fff2d1;box-shadow:0 4px 10px #0005;
  font-size:clamp(11px,2.6cqh,15px)
}
#connectionExit {font-size:inherit;white-space:nowrap;padding:5px 8px}

.draft-actions {display:flex;align-items:stretch;gap:5px}
.draft-actions button {padding:4px .6em;white-space:nowrap}
#timer[data-training]{font-size:clamp(13px,3.6cqh,23px);line-height:1.55}
#trainingTools {
  position:absolute;bottom:max(49px,13cqh);left:50%;transform:translateX(-50%);
  max-width:calc(100% - 205px);width:max-content;
  display:flex;align-items:center;gap:5px;
  padding:4px 6px;background:#15343ee8;color:#fff5d6;
  border:1px solid #f4d68b;border-radius:6px;
  font-size:clamp(10.5px,2.7cqh,14px);white-space:nowrap;
}
#trainingTools button,#trainingTools select{font:inherit;font-weight:800;padding:4px 6px;min-height:29px}
#trainingTools select{color:#173648;background:#fff3d3;border:2px solid #173648;border-radius:5px}
#trainingDummy[aria-pressed=true]{background:#ffd55d}
@container game (orientation:landscape) and (max-height:350px){
  #trainingTools{bottom:41px}
}

#stick[data-active] {border-color:#fff1c6;background:#173c42b8}
#stick[data-active] span {background:#e7c15f;color:#173c42;border-color:#fff5c8}

#viewport {
  position:fixed;inset:0;width:100%;height:100%;height:100dvh;
  container:game / size;
  --safe-top:env(safe-area-inset-top, 0px);
  --safe-right:env(safe-area-inset-right, 0px);
  --safe-bottom:env(safe-area-inset-bottom, 0px);
  --safe-left:env(safe-area-inset-left, 0px);
}
/* Custom properties containing container units resolve at their point of use. */
#shell {--edge:max(3cqw,var(--safe-left),var(--safe-right))}
@media (orientation:portrait) and (pointer:coarse) {
  #viewport {
    width:100vh;width:100dvh;height:100vw;height:100dvw;
    transform-origin:top left;transform:translateX(100vw) rotate(90deg);
    transform:translateX(100dvw) rotate(90deg);
    --safe-top:env(safe-area-inset-right, 0px);
    --safe-right:env(safe-area-inset-bottom, 0px);
    --safe-bottom:env(safe-area-inset-left, 0px);
    --safe-left:env(safe-area-inset-top, 0px);
  }
}
