/* Last layer: two-handed tablet controls, landscape and portrait. */
.touch-toolbar{position:absolute;left:max(16px,env(safe-area-inset-left));top:124px;display:flex;gap:8px}
body.touch-mode .touch-toolbar button{min-width:56px;min-height:48px;font-size:17px;padding:8px 12px}
body.touch-mode #hud .vitals{left:max(12px,env(safe-area-inset-left));top:max(12px,env(safe-area-inset-top));width:270px;max-width:calc(100vw - 90px);padding:10px;gap:8px}
body.touch-mode #hud .vitals .medal{width:46px;height:46px}
body.touch-mode #hud .goal{top:max(12px,env(safe-area-inset-top));right:80px;left:auto;width:min(300px,35vw);max-width:none;padding:10px 12px}
body.touch-mode #hud .goal small,body.touch-mode #hud .goal-kicker{display:none}
body.touch-mode #hud .goal-main b{font-size:18px;line-height:1.3}
body.touch-mode #hud .goal-action{min-height:44px;font-size:16px;padding:6px 10px}
body.touch-mode #hud .spellbar{left:auto;right:max(14px,env(safe-area-inset-right));top:116px;bottom:auto;width:324px}
body.touch-mode #hud .els{display:flex;gap:6px;justify-content:flex-end}
body.touch-mode #hud .el{width:48px;height:48px;min-height:48px;flex:none}
body.touch-mode #hud .el .n{font-size:14px}
body.touch-mode #hud .element-note,body.touch-mode #hud .slots,body.touch-mode #hud .talk-prompt,body.touch-mode .mb-study-hud{display:none!important}
body.touch-mode #hud .mini{left:max(18px,env(safe-area-inset-left));top:190px;bottom:auto;width:96px;height:96px}
body.touch-mode #hud .boss{left:50%;right:auto;top:190px;bottom:auto;transform:translateX(-50%);width:min(420px,45vw)}
body.touch-mode #hud .boss .bn{font-size:22px}
body.touch-mode #hud .boss .bs{font-size:14px;line-height:1.4}
body.touch-mode .move-controls{left:max(24px,env(safe-area-inset-left));bottom:max(24px,env(safe-area-inset-bottom));gap:10px}
body.touch-mode .move-pad{width:136px;height:136px}
body.touch-mode .touch-sprint{min-width:104px;min-height:48px}
body.touch-mode .touch-actions{right:max(18px,env(safe-area-inset-right));bottom:max(20px,env(safe-area-inset-bottom));width:268px;gap:8px;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-areas:'quick quick quick' 'ult fusion heal' 'blink skill attack' 'jump jump attack'}
body.touch-mode .touch-actions .touch-quick-elements{grid-area:quick}
body.touch-mode .touch-actions [data-action=ult]{grid-area:ult}
body.touch-mode .touch-actions [data-action=fusion]{grid-area:fusion}
body.touch-mode .touch-actions [data-action=heal]{grid-area:heal;display:block;min-height:58px!important}
body.touch-mode .touch-actions [data-action=blink]{grid-area:blink}
body.touch-mode .touch-actions [data-action=skill]{grid-area:skill}
body.touch-mode .touch-actions [data-action=jump]{grid-area:jump}
body.touch-mode .touch-actions [data-action=attack]{grid-area:attack;min-height:124px;border-radius:28px;background:#ef994a}
body.touch-mode .touch-actions button{min-width:0;min-height:58px;padding:7px 5px;font-size:17px;border-radius:17px;overflow-wrap:anywhere;line-height:1.25}
body.touch-mode .touch-actions button small{font-size:12px;line-height:1.3}
body.touch-mode .touch-actions button[aria-disabled=true]{opacity:.58}
body.touch-mode .touch-controls .touch-interact{right:max(18px,env(safe-area-inset-right));max-width:268px;min-height:48px;bottom:calc(var(--touch-actions-height,250px) + max(20px,env(safe-area-inset-bottom)) + 12px);font-size:17px!important}
body.touch-mode .touch-hint{left:185px;right:310px;bottom:18px;font-size:14px}
body.touch-mode .toast{bottom:310px;max-width:65vw}
body.touch-mode .card{width:min(780px,94vw);max-height:calc(100dvh - 28px);padding:22px;overscroll-behavior:contain}
body.touch-mode .card button,body.touch-mode .card select{min-height:48px;font-size:18px}
body.touch-mode .mb-study{padding:10px}
body.touch-mode .mb-study-sheet{width:100%;height:calc(var(--touch-viewport-height,100dvh) - 20px);max-height:none;border-width:8px;border-bottom-width:10px}
body.touch-mode .mb-study header{padding:10px 14px;gap:10px}
body.touch-mode .mb-study h2{font-size:23px}
body.touch-mode .mb-study-head-actions button{min-height:48px;font-size:17px}
body.touch-mode .mb-study input,body.touch-mode .mb-study textarea{font-size:20px;min-height:48px}
body.touch-mode .mb-question-tabs{flex-wrap:nowrap;overflow-x:auto;min-height:54px;flex-shrink:0}
body.touch-mode .mb-question-tabs button{min-width:48px;flex-shrink:0}
body.touch-mode .mb-study button{min-height:48px}
body.touch-mode .world-map-card.atlas{width:96vw;height:calc(100dvh - 24px);padding:12px;grid-template-columns:minmax(0,1fr) 235px;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}
body.touch-mode .world-map-card.atlas .world-map-sheet{height:100%;width:auto;max-width:100%;min-height:0;aspect-ratio:1;touch-action:none;justify-self:center}
body.touch-mode .atlas-side{grid-column:2;grid-row:2/4;min-height:0;align-self:stretch;overflow:auto}
body.touch-mode .atlas-tools button{width:48px;height:48px;touch-action:manipulation}
body.touch-mode .world-map-close{min-height:48px}
body.touch-mode .world-map-close kbd{display:none}
body.touch-mode .world-map-card.atlas header{position:sticky;top:-12px;z-index:5;background:#f6ead0;padding:8px 0}
@media(max-width:900px){
 body.touch-mode .mb-study-sheet.is-question .mb-study-body{overflow:auto}
 body.touch-mode .mb-question-grid{display:flex!important;flex-direction:column;min-height:0!important;flex:none!important;overflow:visible!important}
 body.touch-mode .mb-question-left,body.touch-mode .mb-question-card{flex:none!important}
 body.touch-mode .mb-question-left,body.touch-mode .mb-question-card{overflow:visible!important}
 body.touch-mode .mb-memo{min-height:300px}
 body.touch-mode .mb-memo canvas{height:260px!important;min-height:260px!important}
 body.touch-mode .mb-question-left:after{display:none}
 body.touch-mode .mb-study-sheet.is-journal .mb-study-body{overflow:auto;display:block}
 body.touch-mode .mb-journal-spread{display:block}
 body.touch-mode .mb-journal-list{max-height:260px;flex:none}
 body.touch-mode .mb-journal-left{border-right:0;border-bottom:3px solid #d9c49b}
 body.touch-mode .mb-journal-right{overflow:visible}
}
@media(orientation:portrait){
 body.touch-mode #hud .goal{top:116px;left:14px;right:14px;width:auto}
 body.touch-mode #hud .goal-main b{font-size:18px}
 body.touch-mode #hud .goal-action{display:none}
 body.touch-mode #hud .spellbar{top:190px;right:14px;width:324px}
 body.touch-mode .touch-toolbar{top:254px;left:14px}
 body.touch-mode #hud .mini{top:320px;width:88px;height:88px}
 body.touch-mode #hud .boss{top:420px;width:min(460px,80vw)}
 body.touch-mode .touch-hint{display:none}
 body.touch-mode .world-map-card.atlas{display:flex;flex-direction:column;overflow:auto}
 body.touch-mode .world-map-card.atlas .world-map-sheet{height:auto;width:min(100%,62dvh);flex:none}
 body.touch-mode .atlas-side{overflow:visible;flex:none}
}
@media(max-height:600px) and (orientation:landscape){
 body.touch-mode .touch-toolbar{top:122px}
 body.touch-mode #hud .mini{top:182px;width:76px;height:76px}
 body.touch-mode #hud .spellbar{top:108px}
 body.touch-mode #hud .boss{top:166px;width:min(360px,44vw)}
 body.touch-mode .move-pad{width:112px;height:112px}
 body.touch-mode .move-controls{bottom:16px;gap:6px}
 body.touch-mode .touch-actions{width:248px;gap:6px;bottom:16px}
 body.touch-mode .touch-actions button{min-height:48px;font-size:15px;padding:6px 4px}
 body.touch-mode .touch-actions [data-action=heal]{min-height:48px!important}
 body.touch-mode .touch-actions [data-action=attack]{min-height:102px}
 body.touch-mode .touch-hint{display:none}
}
