html,body{margin:0;padding:0;width:100%;height:100%;overflow:hidden;background:#070a1e;user-select:none;-webkit-user-select:none;touch-action:none;-webkit-tap-highlight-color:transparent}
#stage,#ui{position:fixed;left:0;top:0;width:100%;height:100%}
#stage canvas{display:block}
#ui{pointer-events:none;--font:"Arial Black","Trebuchet MS",sans-serif;font-family:var(--font);color:#fff6e0;overflow:hidden}
#ui *{box-sizing:border-box}
#ui .tx,#ui .btn,#ui .pill{font-family:var(--font);font-weight:900;color:#fff6e0;-webkit-text-stroke:3px #1a1024;paint-order:stroke fill;text-shadow:0 2px 0 #1a1024}
#ui .hid{display:none!important}
#ui .panel{border:22px solid transparent;border-image:url(../assets/ui-panel.webp) 64 fill/22px stretch;background:none}
#ui .btn{pointer-events:auto;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 14px;border:14px solid transparent;border-image:url(../assets/ui-button.webp) 40 fill/14px stretch;font-size:clamp(14px,2.8vh,20px);transition:transform .15s cubic-bezier(.3,1.6,.5,1),filter .15s;text-align:center;line-height:1.1}
#ui .btn img{width:1.5em;height:1.5em;object-fit:contain;flex:none}
#ui .btn small{display:block;font-size:.7em;opacity:.85;-webkit-text-stroke-width:2px}
#ui .btn.focus,#ui .btn:hover{transform:scale(1.06);filter:brightness(1.2) drop-shadow(0 0 8px #7fe0ff)}
#ui .btn:active,#ui .btn.press{transform:scale(.93)}
#ui .btn.off{filter:grayscale(.8) brightness(.6);cursor:default}
#ui .btn.quiet{filter:brightness(.8) saturate(.7)}
@keyframes pop{0%{transform:scale(.6);opacity:0}70%{transform:scale(1.07);opacity:1}100%{transform:scale(1)}}
@keyframes slam{0%{transform:scale(1.7);opacity:0}55%{transform:scale(.94);opacity:1}100%{transform:scale(1)}}
@keyframes drop{0%{transform:translateY(-120%) scale(1.1)}60%{transform:translateY(8%)}100%{transform:translateY(0)}}
@keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
@keyframes pulse{0%,100%{transform:scale(1);opacity:.85}50%{transform:scale(1.08);opacity:1}}
@keyframes shine{0%{transform:translateX(-120%) skewX(-20deg)}50%,100%{transform:translateX(320%) skewX(-20deg)}}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes glow{0%,100%{box-shadow:0 0 4px #7fe0ff}50%{box-shadow:0 0 16px 4px #7fe0ff}}
@keyframes fadeout{0%,70%{opacity:1}100%{opacity:0}}

/* title */
#title{position:absolute;inset:0;pointer-events:auto;background:#070a1e;transition:opacity .4s}
#title.out{opacity:0;pointer-events:none}
#title .bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
#title .logowrap{position:absolute;left:3%;top:4%;max-width:46%;max-height:33%;width:46%;height:33%;animation:drop .55s cubic-bezier(.3,1.4,.5,1) both;pointer-events:none}
#title .logoin{position:absolute;inset:0;animation:float 3.5s ease-in-out infinite .6s;overflow:hidden}
#title .logoin img{width:100%;height:100%;object-fit:contain;object-position:left top;display:block;filter:drop-shadow(0 4px 8px rgba(0,0,0,.6))}
#title .logoin:after{content:"";position:absolute;top:0;bottom:0;left:0;width:18%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);animation:shine 4s ease-in-out infinite 1s;mix-blend-mode:overlay}
#title .prompt{position:absolute;left:50%;bottom:7%;transform:translateX(-50%);font-size:clamp(18px,4.2vh,32px);white-space:nowrap;animation:pulse 1.3s ease-in-out infinite;pointer-events:none;color:#ffe9a8}
#title .ctl{position:absolute;left:2%;bottom:3%;width:29%;min-width:200px;padding:0;font-size:14px;pointer-events:none}
#title .ctl.panel{border-width:18px;border-image-width:18px}
#title .ctl h4{margin:0 0 4px;font-size:15px;color:#ffd27a}
#title .row{display:flex;align-items:center;gap:6px;margin:3px 0;font-size:14px;line-height:1.15}
#title .chip{flex:none;min-width:34px;padding:2px 6px;border-radius:6px;background:#e8b45a;color:#2a1a08;border:2px solid #1a1024;font-size:12px;text-align:center;-webkit-text-stroke:0;text-shadow:none;font-weight:900}
#title .note{font-size:12px;opacity:.85;margin-top:2px}
#title .corner{position:absolute;top:12px;right:12px;display:flex;gap:8px;align-items:center}
#title .trophy{pointer-events:auto;width:48px;height:48px;cursor:pointer;transition:transform .15s cubic-bezier(.3,1.6,.5,1)}
#title .trophy:hover{transform:scale(1.12)}#title .trophy:active{transform:scale(.9)}
#title .trophy img{width:100%;height:100%;object-fit:contain}
#title .corner .btn{min-height:48px;font-size:14px;max-width:200px}
#loading{position:absolute;left:50%;bottom:2%;transform:translateX(-50%);display:flex;align-items:center;gap:8px;font-size:16px}
#loading img{width:26px;height:26px;animation:spin 1.2s linear infinite}

/* hud */
#hud{position:absolute;inset:0}
#hud .plate{position:absolute;left:76px;top:10px;width:clamp(180px,24vw,280px);padding:0}
#hud .plate.panel{border-width:12px;border-image-width:12px}
#hud .bar{position:relative;flex:1;height:20px;border-radius:10px;background:#120a22;border:2px solid #e8b45a;overflow:hidden}
#hud .bar i{position:absolute;left:0;top:0;bottom:0;width:100%;transform-origin:left;transition:transform .2s}
#hud .hpf{background:linear-gradient(#ff8aa0,#e0304f)}
#hud .xpf{background:linear-gradient(#b8f2ff,#2ab4e8)}
#hud .bar span{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:14px;-webkit-text-stroke:3px #1a1024}
#hud .line{display:flex;align-items:center;gap:6px;margin:1px 0}
#hud .line img{width:24px;height:24px;object-fit:contain;flex:none}
#hud .lv{flex:none;min-width:38px;padding:1px 6px;border-radius:8px;background:linear-gradient(#ffe29a,#c8964a);color:#2a1a08;border:2px solid #1a1024;font-size:14px;text-align:center;-webkit-text-stroke:0;text-shadow:none}
#hud .items{position:absolute;left:76px;top:calc(10px + 90px);display:flex;gap:6px;flex-wrap:wrap;max-width:280px}
#hud .it{position:relative;width:34px;height:34px;border-radius:8px;background:rgba(11,16,48,.75);border:2px solid #e8b45a}
#hud .it img{width:100%;height:100%;object-fit:contain}
#hud .it b{position:absolute;right:-4px;bottom:-5px;font-size:12px;background:#e8b45a;color:#2a1a08;border-radius:6px;padding:0 4px;border:1px solid #1a1024;-webkit-text-stroke:0;text-shadow:none}
#hud .top{position:absolute;left:50%;top:8px;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:2px}
#hud .top .r1{display:flex;gap:14px;align-items:center;font-size:clamp(15px,3vh,20px)}
#hud .goDoor{animation:pulse .8s infinite;color:#9ff0ff}
#hud .gold{display:flex;align-items:center;gap:4px}#hud .gold img{width:24px;height:24px}
#hud .score{font-size:14px;opacity:.9}
#hud .boss{position:relative;width:min(50vw,560px);margin-top:4px;text-align:center}
#hud .boss .bb{height:18px;border-radius:9px;border:3px solid #e8b45a;background:#1a0810;overflow:hidden;position:relative}
#hud .boss .bb i{position:absolute;inset:0;background:linear-gradient(#e04040,#7a0f1c);transform-origin:left;transition:transform .2s}
#hud .boss span{font-size:14px}
#hud .skills{position:absolute;left:50%;bottom:12px;transform:translateX(-50%);display:flex;gap:18px}
#hud .sk{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:13px}
#hud .sk .pl{position:relative;width:56px;height:56px;border-radius:50%;background:radial-gradient(#3a2a18,#120a08);border:3px solid #e8b45a;overflow:hidden}
#hud .sk .pl.ready{animation:glow 1.2s infinite}
#hud .sk .pl img{position:absolute;inset:4px;width:calc(100% - 8px);height:calc(100% - 8px);object-fit:contain}
#hud .sk .pl .sw{position:absolute;inset:0}
#hud .sk .pl .sec{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:18px}

/* overlays */
#choices,#revive{position:absolute;inset:0;background:rgba(5,8,25,.6);pointer-events:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2vh;transition:opacity .2s}
#choices.out,#revive.out{opacity:0;pointer-events:none}
#choices{justify-content:flex-start;padding-top:9vh;box-sizing:border-box}
#choices .ttl{font-size:clamp(22px,6vh,44px);animation:slam .35s cubic-bezier(.3,1.4,.5,1) both;color:#ffe9a8;font-weight:900;-webkit-text-stroke:0;text-shadow:3px 0 0 #1a1024,-3px 0 0 #1a1024,0 3px 0 #1a1024,0 -3px 0 #1a1024,2px 2px 0 #1a1024,-2px 2px 0 #1a1024,2px -2px 0 #1a1024,-2px -2px 0 #1a1024,0 6px 0 #1a1024}
#choices .cards{display:flex;gap:12px;justify-content:center}
#choices .card{pointer-events:auto;cursor:pointer;width:min(26vw,300px);height:auto;min-height:min(44vh,270px);padding-top:6px!important;box-sizing:border-box;min-width:100px;display:flex;flex-direction:column;align-items:center;gap:clamp(2px,1vh,8px);padding:0;text-align:center;animation:pop .3s cubic-bezier(.3,1.5,.5,1) backwards;transition:transform .15s cubic-bezier(.3,1.6,.5,1),filter .15s;overflow:hidden}
#choices .card.focus,#choices .card:hover{transform:scale(1.06);filter:drop-shadow(0 0 12px #7fe0ff)}
#choices .card.sq{transform:scale(.9)}
#choices .card .ic{width:min(15vh,96px);height:min(15vh,96px);object-fit:contain;flex:none}
#choices .card .nm{font-size:clamp(14px,3.6vh,20px);line-height:1.1}
#choices .card .bd{font-size:clamp(12px,2.6vh,15px);padding:1px 8px;border-radius:8px;background:linear-gradient(#ffe29a,#c8964a);color:#2a1a08;border:2px solid #1a1024;-webkit-text-stroke:0;text-shadow:none}
#choices .card .bd.new{background:linear-gradient(#ffb0c0,#e0304f);color:#fff}
#choices .pips{display:flex;gap:4px}#choices .pips i{width:12px;height:12px;border-radius:50%;background:#1a1024;border:2px solid #e8b45a}#choices .pips i.on{background:#7fe0ff}
#choices .card .ds{font-size:clamp(12px,2.7vh,15px);line-height:1.25;overflow-wrap:anywhere;font-weight:700;-webkit-text-stroke:2px #1a1024;padding:0 2px}
#choices .rr{min-width:min(220px,40vw)}
#revive .box{width:min(520px,94vw);padding:0;display:flex;flex-direction:column;align-items:center;gap:6px;animation:pop .3s cubic-bezier(.3,1.5,.5,1) both;pointer-events:auto}
#revive .box.panel{padding:6px 10px}
#revive .ttl{font-size:clamp(22px,5.5vh,34px);color:#ff9fb0}
#revive .hold{display:flex;gap:16px;align-items:center;font-size:clamp(14px,3vh,18px)}
#revive .hold span{display:flex;align-items:center;gap:4px}#revive .hold img{width:26px;height:26px;object-fit:contain}
#revive .btns{display:flex;flex-direction:column;gap:6px;width:min(340px,86%)}
#revive .btns .btn{width:100%;min-height:clamp(44px,10.5vh,54px)}
#revive .msg{font-size:15px;text-align:center}

/* misc */
#banner{position:absolute;left:0;right:0;top:35%;display:flex;justify-content:center;pointer-events:none}
.bn{font-size:clamp(28px,8vh,60px);max-width:92vw;text-align:center;color:#ffe9a8!important;-webkit-text-stroke:8px #1a1024;paint-order:stroke fill;text-shadow:0 5px 0 #1a1024;animation:slam .4s cubic-bezier(.3,1.5,.5,1) both,fadeout var(--ms,1600ms) linear forwards;position:absolute;font-family:var(--font);font-weight:900}
#sub{position:absolute;left:50%;top:78%;transform:translateX(-50%);max-width:70%;padding:8px 16px;border-radius:14px;background:rgba(10,8,28,.72);border:1px solid rgba(232,180,90,.5);font-size:clamp(14px,3vh,18px);text-align:center;line-height:1.35;transition:opacity .2s;pointer-events:none;font-weight:700}
#ui.modal #sub{opacity:0}
/* phones held sideways: HUD hugs the left edge under the platform's back button; subtitles go up top, away from the thumbs */
@media (max-height:500px){
  #hud .plate{left:10px;top:68px;width:clamp(170px,26vw,240px)}
  #hud .items{left:10px;top:148px;max-width:240px}
  #sub{top:52px;max-width:46%}
}
#toast{position:absolute;left:50%;top:60px;transform:translateX(-50%);pointer-events:none;display:flex;flex-direction:column;align-items:center;gap:4px}
.pill{padding:5px 16px;border-radius:20px;background:rgba(11,16,48,.8);border:2px solid #e8b45a;font-size:15px;animation:pop .25s both,fadeout 2.2s linear forwards;-webkit-text-stroke:2px #1a1024}
#fade{position:absolute;inset:0;background:#000;opacity:0;pointer-events:none}
