/* Phone-first input sizing; preserve the desktop game surface. */
@media(max-width:760px),(pointer:coarse){
  #hud{display:grid;grid-template-columns:minmax(105px,1fr) auto 44px 44px;gap:6px;left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));top:max(8px,env(safe-area-inset-top));align-items:center}
  #hud .seal{display:none}.vitals{width:auto;max-width:205px;min-height:44px;padding:6px 8px}.life{font-size:12px}.life b{font-size:12px}.life+.life{margin-top:4px}
  #pause,#route{width:44px;height:44px;font-size:14px;padding:0}.scroll-count{margin:0;padding:7px;font-size:12px;white-space:nowrap;min-height:44px;display:flex;align-items:center;gap:4px}
  .journey{grid-column:1/-1;width:100%;min-height:28px;padding:4px 8px;gap:7px}.journey small{font-size:11px;max-width:132px}.journey>span{font-size:12px}
  #party{top:calc(max(8px,env(safe-area-inset-top)) + 85px);left:max(10px,env(safe-area-inset-left));font-size:11px}
  #notice{top:calc(max(8px,env(safe-area-inset-top)) + 110px);font-size:13px;max-width:94vw;pointer-events:none}
  #touch{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));align-items:center;gap:10px}
  #joystick{position:relative;width:128px;height:128px;flex-shrink:0;border:2px solid #d6bc7688;border-radius:50%;background:radial-gradient(circle,#1e54414d 25%,#153f3299 70%);box-shadow:inset 0 0 0 17px #cfb77812;pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none}
  #joystick-thumb{position:absolute;width:48px;height:48px;left:calc(50% - 24px);top:calc(50% - 24px);border-radius:50%;border:2px solid #ead196;background:#3b6454dd;box-shadow:0 4px 12px #0005;pointer-events:none}
  #joystick small{position:absolute;bottom:7px;left:0;right:0;text-align:center;color:#eee0bd;font-size:11px;pointer-events:none}
  #joystick.active{border-color:#ffe2a1}#joystick.active #joystick-thumb{background:#ba985cdd}
  .touch-actions{display:block;position:relative;width:146px;height:146px;flex-shrink:0;touch-action:none}
  #touch .touch-actions button{position:absolute;touch-action:none}
  #touch [data-key="ShiftLeft"]{left:0;top:43px}
  #touch [data-key="KeyE"]{right:4px;top:0}
  #touch .touch-actions button{width:54px;height:54px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:2px;line-height:1.1;font-size:14px;background:#193f33eb;box-shadow:0 3px 14px #102a234d}
  #touch .touch-actions b{font-weight:700;font-size:14px}#touch .touch-actions small{font-size:11px;color:#e0d3a3}
  #touch .touch-actions .attack{right:0;bottom:0;width:76px!important;height:76px!important;background:#a6412aee!important;border:3px solid #e7bd7b;box-shadow:0 0 0 4px #d2af5922}#touch .touch-actions .attack b{font-size:19px}
  #touch button.cooling{border-color:#8b947b!important}#touch button.cooling small{color:#edb96f}#touch button.pressed{background:#d0a754!important;color:#182b23!important;transform:scale(.95)}
  #objective{bottom:calc(max(18px,env(safe-area-inset-bottom)) + 156px);font-size:12px;padding:7px 10px;line-height:1.4;max-width:93vw}
  #talk{bottom:calc(max(18px,env(safe-area-inset-bottom)) + 208px);min-height:46px;padding:11px 18px;font-size:14px}
  #overlay{padding:max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
  #panel{max-height:calc(100svh - 28px);padding:18px;scrollbar-width:thin;-webkit-overflow-scrolling:touch}#main-button{min-height:48px;width:100%}#map-secondary{min-height:44px}#chapter-list button{min-height:46px}
}
@media(max-width:350px){#joystick{width:118px;height:118px}.life span{width:26px}.life{gap:4px}.scroll-count{padding:5px;font-size:11px}}
@media(orientation:landscape) and (max-height:520px){
  #hud{grid-template-columns:145px minmax(130px,1fr) auto 44px 44px;gap:8px}.journey{grid-column:2;grid-row:1;min-height:44px;display:block;max-width:330px;margin:auto}.journey .track{margin:4px 0}.journey small{display:none}.scroll-count{grid-column:3;grid-row:1}#route{grid-column:4;grid-row:1}#pause{grid-column:5;grid-row:1}
  #party{top:64px}#notice{top:64px;max-width:55vw;padding:6px 10px}#objective{bottom:max(12px,env(safe-area-inset-bottom));max-width:43vw;font-size:11px}#talk{bottom:60px;max-width:45vw;padding:9px 12px}
  #touch{bottom:max(12px,env(safe-area-inset-bottom))}#panel{max-width:620px;margin:auto;padding:14px 20px}#panel .eyebrow{margin:0 0 7px}#panel h1{font-size:30px;margin-bottom:10px}#panel h1 span{font-size:21px;margin-top:8px}#panel-copy{font-size:14px;line-height:1.55;margin:9px 0}#rules{font-size:12px;margin:8px 0}#main-button{margin:12px 0 8px;min-height:44px}#panel-note{font-size:11px}#chapter-list{gap:6px;margin:10px 0}
}
