html,body{width:100%;height:100%}
html,body{overscroll-behavior:none}
canvas{touch-action:none}
.modal,.panel{touch-action:pan-y}
#touch-controls{display:none;pointer-events:none;position:absolute;inset:0;user-select:none;-webkit-user-select:none}
.touch-device[data-mode="play"] #touch-controls{display:block}
#joystick{position:absolute;left:max(22px,env(safe-area-inset-left));bottom:max(25px,env(safe-area-inset-bottom));width:118px;height:118px;border:1px solid #e7efd05c;border-radius:50%;background:#142b2570;pointer-events:auto;touch-action:none}
#joystick:before{content:'移動';position:absolute;top:-23px;left:42px;font-size:10px;color:#d3dfc9}
#joystick-thumb{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:46px;height:46px;border-radius:50%;border:1px solid #d8edb9aa;background:#a4b99a65;pointer-events:none}
.touch-actions{position:absolute;right:max(20px,env(safe-area-inset-right));bottom:max(22px,env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(3,54px);gap:9px;align-items:center}
.touch-actions button{min-height:48px;min-width:48px;touch-action:none;border-radius:12px;border:1px solid #e5f3d460;color:#edf6e4;background:#19382bd9;font-size:12px;padding:5px;pointer-events:auto}
.touch-actions [data-touch="attack"]{background:#d8edb9;color:#20362b;min-height:62px;font-size:16px}
.touch-actions [data-touch="skill"]{background:#355957;min-height:62px}
.touch-actions small{display:block;font-size:9px;opacity:.75}
#touch-hint{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);font-size:10px;color:#e0e9d6;white-space:nowrap;text-shadow:0 1px 4px #000}
.touch-device .keys,.touch-device [data-command="mouse_lock"]{display:none}
.touch-device #controls{bottom:205px;right:20px;left:auto}
.touch-device .tool{padding:8px 12px;min-width:160px}
.touch-device #skills{bottom:285px;right:20px}
.touch-device #weapons{bottom:188px;left:20px}
.touch-device #prompt{bottom:302px}
.touch-device .footer>span:first-child{font-size:0}
.touch-device .footer>span:first-child:after{content:'支援觸控 · 建議橫向遊玩';font-size:10px}
@media(max-width:950px) and (max-height:550px){
 .touch-device .top{inset:10px 16px auto}.touch-device .brand{font-size:19px}.touch-device .location{font-size:10px;padding:6px 10px}
 .touch-device #action-buttons{top:49px;right:16px;gap:4px}.touch-device .small-button{padding:8px;font-size:10px;min-height:35px}
 .touch-device #progress{top:48px;left:16px;width:182px;padding:9px}.touch-device .progress p{font-size:11px;margin:5px 0}.touch-device .objective{font-size:9px;margin-top:4px}.touch-device .rule{display:none}
 .touch-device #weapons{bottom:10px;left:160px;max-width:35%;flex-wrap:wrap;gap:4px}.touch-device .pick button{font-size:10px;padding:7px}.touch-device .pick kbd,.touch-device .pick small{display:none}
 .touch-device #skills{right:16px;bottom:205px;gap:3px}.touch-device #controls{left:165px;right:auto;bottom:78px}.touch-device .tool{min-width:160px;padding:6px 10px}.touch-device .tool strong{font-size:11px;margin:3px 0}
 .touch-device #prompt{bottom:auto;top:54%;padding:6px 12px;font-size:11px}.touch-device #combo{top:85px;right:24px}.touch-device #combo b{font-size:35px}
 .touch-device .intro h1{font-size:72px;margin:10px 0}.touch-device .intro p{margin:10px 0 16px}.touch-device .features{margin-top:15px}.touch-device .footer{bottom:10px}
 .touch-device .panel{padding:20px;max-height:94vh}.touch-device .panel h2{font-size:23px}.touch-device .cards{grid-template-columns:repeat(3,1fr)}.touch-device .art{height:50px}
}
@media(max-width:550px) and (orientation:portrait){
 .touch-device #action-buttons{top:64px;left:16px;right:16px;justify-content:flex-end;flex-wrap:wrap}
 .touch-device #progress{top:115px;left:16px;width:178px;padding:10px}.touch-device #progress p{margin:6px 0}.touch-device #goals{display:none}
 .touch-device #weapons{bottom:258px;left:16px;right:16px;gap:4px}.touch-device .pick button{padding:8px;font-size:10px}.touch-device .pick kbd{display:none}
 .touch-device #skills{bottom:212px;left:16px;right:auto}.touch-device #controls{bottom:307px;right:16px}.touch-device #prompt{bottom:370px;font-size:11px;max-width:90%;width:max-content}
 .touch-device #combo{top:210px;right:18px}.touch-device #combo b{font-size:38px}.touch-device .cards{grid-template-columns:1fr 1fr}.touch-device .panel{padding:20px}
}
