*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{width:100%;height:100%;overflow:hidden;background:#1d1530;touch-action:none;user-select:none;-webkit-user-select:none;
  font-family:"Trebuchet MS","Arial Rounded MT Bold",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:#1d1530}
canvas{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none}
button{font:inherit;cursor:pointer;border:0;color:inherit}
.panel{position:fixed;inset:0;display:none;align-items:center;justify-content:center;padding:10px;z-index:5;background:rgba(29,21,48,.45)}
.panel.show{display:flex}
.card{position:relative;width:min(560px,100%);max-height:100%;overflow:auto;touch-action:pan-y;background:#fff8ea;border:4px solid #1d1530;border-radius:22px;
  padding:12px 16px 12px;text-align:center;box-shadow:0 7px 0 #1d1530,0 18px 40px rgba(0,0,0,.4);
  background-image:radial-gradient(circle at 50% -30%,rgba(255,138,28,.28),transparent 60%)}
h1{font-size:42px;line-height:1.02;font-weight:900;color:#ffd52e;letter-spacing:.5px;
  text-shadow:3px 3px 0 #1d1530,-2px 2px 0 #1d1530,2px -2px 0 #1d1530,-2px -2px 0 #1d1530,0 6px 0 #e32b2b}
.sub{display:inline-block;font-size:16px;font-weight:900;color:#fff;background:#e32b2b;border:3px solid #1d1530;border-radius:12px;
  padding:1px 12px;margin:6px 0 8px;transform:rotate(-2deg)}
.modes{display:flex;gap:6px;justify-content:center;flex-wrap:wrap}
.mode{padding:7px 10px;border-radius:12px;background:#fff;border:3px solid #1d1530;font-weight:900;font-size:14px;box-shadow:0 3px 0 #1d1530}
.mode.sel{background:#ffd52e}
.hint{font-weight:900;font-size:14px;margin:8px 0 5px}
.hint.tiny{font-size:12px;font-weight:700;color:#5b5370;margin:4px 0 0}
#grid{display:grid;grid-template-columns:repeat(6,1fr);gap:6px}
.fbtn{position:relative;border-radius:14px;border:3px solid #1d1530;overflow:hidden;background:#ddd;box-shadow:0 3px 0 #1d1530;aspect-ratio:1/1.12;padding:0}
.fbtn img{width:100%;height:auto;display:block;aspect-ratio:1}
.fbtn span{position:absolute;left:0;right:0;bottom:0;font-size:11px;font-weight:900;background:#1d1530;color:#fff;padding:2px 0;white-space:nowrap;overflow:hidden}
.fbtn.p1{outline:4px solid #ffd52e;outline-offset:-1px;transform:translateY(-3px)}
.fbtn.p2{outline:4px solid #39a0ff;outline-offset:-1px;transform:translateY(-3px)}
.fbtn.p1.p2{outline-color:#59d32a}
.fbtn i{position:absolute;top:3px;font-style:normal;font-size:11px;font-weight:900;border-radius:7px;padding:0 5px;border:2px solid #1d1530}
.fbtn i.t1{left:3px;background:#ffd52e}.fbtn i.t2{right:3px;background:#39a0ff;color:#fff}
#info{font-size:13px;font-weight:700;margin:7px 0 2px;min-height:18px;color:#3b3350}
#info b{font-weight:900;color:#1d1530}
.diff{display:none;gap:6px;justify-content:center;margin-top:6px}
.diff.show{display:flex}
.dbtn{padding:4px 12px;border-radius:10px;background:#fff;border:3px solid #1d1530;font-weight:900;font-size:13px}
.dbtn.sel{background:#59d32a}
.big{display:block;width:100%;margin:10px 0 6px;padding:12px 0;font-size:32px;font-weight:900;color:#fff;border-radius:18px;
  background:linear-gradient(#ff9a2e,#e8431c);border:4px solid #1d1530;box-shadow:0 6px 0 #1d1530;letter-spacing:2px;text-shadow:0 3px 0 #1d1530}
.big:active{transform:translateY(4px);box-shadow:0 2px 0 #1d1530}
.small{margin-top:6px;padding:8px 22px;font-size:17px;font-weight:900;border-radius:14px;background:#fff;border:3px solid #1d1530;box-shadow:0 3px 0 #1d1530}
#keys{display:flex;gap:6px;justify-content:center;flex-wrap:wrap;margin-top:2px}
.kp{display:flex;align-items:center;gap:3px;padding:4px 7px;border-radius:12px;border:2px solid #1d1530;background:#fff;flex-wrap:wrap;justify-content:center}
.kp.j1{background:#fff3b8}.kp.j2{background:#cfe6ff}
.kp b{margin-right:3px;font-size:12px}
.kp em{font-style:normal;font-size:11px;margin:0 4px 0 1px;color:#3b3350;font-weight:700}
.k{display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 3px;border-radius:6px;background:#fff;border:2px solid #1d1530;
  box-shadow:0 2px 0 #1d1530;font-weight:900;font-size:12px}
.tnote{font-size:12px;font-weight:700;margin-top:6px}
.intro{font-size:12.5px;line-height:1.35;margin-top:7px;color:#4a4260}
.lvTitle,.resTitle{font-size:34px;font-weight:900;color:#ffd52e;text-shadow:3px 3px 0 #1d1530,-2px 2px 0 #1d1530,2px -2px 0 #1d1530,-2px -2px 0 #1d1530}
#tower{display:flex;justify-content:center;gap:5px;margin:8px 0}
.tw{position:relative;width:44px;height:44px;border-radius:10px;border:3px solid #1d1530;overflow:hidden;background:#ccc}
.tw img{width:100%;height:100%}
.tw.done img{filter:grayscale(1) brightness(.7)}
.tw.done::after{content:"✔";position:absolute;inset:0;display:grid;place-items:center;font-size:24px;color:#59d32a;font-weight:900;text-shadow:0 2px 0 #1d1530}
.tw.cur{outline:4px solid #ff8a1c;transform:scale(1.12)}
.tw.boss{border-color:#4f6bff}
.vsRow{display:flex;align-items:center;justify-content:center;gap:10px;margin-top:6px}
.vsRow img{width:110px;height:110px;border-radius:18px;border:4px solid #1d1530;box-shadow:0 4px 0 #1d1530}
.vsRow img#lvOpp{transform:scaleX(-1)}
.vsTxt{font-size:36px;font-weight:900;color:#e32b2b;text-shadow:2px 2px 0 #1d1530}
.lvName{font-size:20px;font-weight:900;margin-top:8px}
.lvStats{font-size:14px;font-weight:700;margin-top:4px;color:#3b3350}
.resSub{font-size:17px;font-weight:900;margin-top:4px}
.resScore{font-size:15px;font-weight:700;margin-top:8px;line-height:1.5}
#hudBtns{position:fixed;top:8px;right:8px;z-index:8;display:flex;gap:6px}
.round{width:38px;height:38px;border-radius:50%;background:#fff8ea;border:3px solid #1d1530;display:grid;place-items:center;box-shadow:0 3px 0 #1d1530}
.round svg{width:20px;height:20px;fill:#1d1530;stroke:#1d1530;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
.round svg .off{display:none}
.round.muted svg .on{display:none}.round.muted svg .off{display:inline}
#btnHome{display:none}
body.fighting #btnHome{display:grid}
#touch{position:fixed;left:0;right:0;bottom:0;z-index:6;display:none;pointer-events:none}
body.fighting.touchui #touch{display:block}
#pad,#acts{position:absolute;bottom:calc(12px + env(safe-area-inset-bottom));pointer-events:auto}
#pad{left:12px;width:168px;height:150px}
#pad .tb{position:absolute;width:56px;height:56px}
#pad [data-k=l]{left:0;top:48px}#pad [data-k=r]{left:112px;top:48px}#pad [data-k=u]{left:56px;top:0}#pad [data-k=b]{left:56px;top:94px}
#acts{right:12px;width:200px;height:150px}
.tb{border-radius:16px;background:rgba(255,248,234,.82);border:3px solid #1d1530;font-weight:900;font-size:13px;color:#1d1530;touch-action:none;
  box-shadow:0 3px 0 #1d1530}
.tb.on{transform:translateY(3px);box-shadow:0 0 0 #1d1530;filter:brightness(.85)}
#acts .tb{position:absolute;width:64px;height:58px}
#acts .p{right:70px;bottom:0;background:rgba(255,213,46,.9)}
#acts .k{right:0;bottom:0;background:rgba(255,138,28,.9)}
#acts .s{right:136px;bottom:0;background:rgba(179,107,255,.9);color:#fff;font-size:11px}
#acts .d{right:0;bottom:64px;background:rgba(57,160,255,.9);color:#fff;font-size:11px}
#acts .x{right:70px;bottom:64px;background:rgba(160,160,160,.85);color:#fff}
#acts .x.ready{background:rgba(227,43,43,.95);animation:pulse .6s infinite alternate}
@keyframes pulse{to{transform:scale(1.08)}}
@media (max-height:430px){
  .card{padding:8px 12px}
  h1{font-size:30px}.sub{margin:3px 0 4px;font-size:14px}
  .big{font-size:24px;padding:8px 0;margin:6px 0 4px}
  #grid .fbtn{aspect-ratio:1/1}
  .vsRow img{width:76px;height:76px}
}
@media (max-width:520px){
  #grid{grid-template-columns:repeat(3,1fr)}
  h1{font-size:34px}
  .fbtn span{font-size:12px}
}
