.touch-stick,.touch-tools{display:none}
/* Native selection/callouts must not steal a gameplay gesture. Forms and chat
   retain normal text editing, selection and scrolling. */
#game-shell :is(#world,.touch-stick,.touch-stick *, .action-dock,.action-dock *, .touch-tools,.touch-tools *, #player-card,#player-card *, .right-column,.right-column *, .target-card,.target-card *, .topbar,.topbar *, .bottom-hud,.bottom-hud *, .mobile-tabs,.mobile-tabs *){-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
#game-shell :is(.action-dock button,.touch-tools button,.mobile-tabs button){touch-action:manipulation}
@media(pointer:coarse){
 #game-shell{--mobile-nav-height:calc(48px + env(safe-area-inset-bottom,0px))}
 #game-shell.touch-playing .touch-stick{display:block;position:absolute;z-index:5;left:max(16px,env(safe-area-inset-left));bottom:calc(68px + env(safe-area-inset-bottom));width:116px;height:116px;border:2px solid #c6cba66e;border-radius:50%;background:#11251d8c;touch-action:none;user-select:none;box-shadow:0 2px 16px #0004}
 .stick-knob{position:absolute;left:50%;top:50%;width:52px;height:52px;border-radius:50%;background:#82997cc9;border:2px solid #e0d4a9;transform:translate(-50%,-50%);pointer-events:none}
 .stick-guides{position:absolute;inset:0;display:grid;place-items:center;font-size:70px;color:#ced5b42b;pointer-events:none}
 .touch-stick small{position:absolute;bottom:-24px;width:100%;text-align:center;color:#eee3c6;font-size:12px;pointer-events:none}
 #game-shell .touch-tools{display:flex;position:absolute;right:max(8px,env(safe-area-inset-right,0px));top:max(8px,env(safe-area-inset-top,0px));z-index:8;gap:6px}
 .touch-tools button{min-width:44px;min-height:44px;border:1px solid #64785d;background:#14241eee;color:#ead7a6;border-radius:8px;font-size:13px;padding:6px}
 #game-shell .topbar,#game-shell .topbar:has(.header-wallet:not(.hidden)){height:58px;display:flex;padding:0 110px 0 10px;gap:6px}
 #game-shell .topbar .brand{font-size:16px;gap:6px}
 #game-shell .topbar .brand-mark{width:26px;height:30px;font-size:22px;line-height:30px}
 #game-shell .topbar :is(.brand small,.connection,#help-button,.nav-tabs,.desktop-menu-pages){display:none}
 #game-shell .topbar .header-wallet{display:none}
 #game-shell.touch-menu .topbar .header-wallet:not(.hidden){display:flex;position:absolute;right:8px;top:64px;z-index:9;background:#14241e;padding:8px;border-radius:8px}
 #game-shell .mobile-tabs{position:absolute;inset:auto 0 0;z-index:11;height:var(--mobile-nav-height);display:flex;overflow-x:auto;padding:0 env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);background:#111a15;border-top:1px solid #414b36}
 #game-shell .mobile-tabs :is(button,a){min-height:44px;flex-shrink:0}
 #game-shell .mobile-tabs button{flex:1 0 auto;min-width:64px;padding:0 8px;font-size:13px;white-space:nowrap}
 #game-shell.touch-playing:not(.touch-menu) .mobile-tabs{display:none}
 #game-shell.touch-playing .bottom-hud{left:auto;right:max(12px,env(safe-area-inset-right));bottom:calc(22px + env(safe-area-inset-bottom));width:168px;display:block}
 #game-shell.touch-playing .combat-controls{width:100%;gap:5px}
 #game-shell.touch-playing .action-dock{display:grid;grid-template-columns:66px 90px;gap:6px;padding:0;border:0;background:none;align-items:end}
 #game-shell.touch-playing .action-dock #nearby-button{width:66px;min-height:66px;border-radius:50%;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:5px;gap:0;background:#203c30ee}
 #game-shell.touch-playing #nearby-button .slot-icon{display:none}
 #game-shell.touch-playing #nearby-button strong{font-size:13px}
 #game-shell.touch-playing #nearby-button small{max-width:56px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px}
 #game-shell.touch-playing #attack-button{width:90px;height:90px;border-radius:50%;padding:6px;background:#76512eee;overflow:hidden}
 #game-shell.touch-playing #attack-button strong{font-size:18px}
 #game-shell.touch-playing #attack-button small{font-size:10px}
 #game-shell.touch-playing #auto-attack-button{grid-column:2;grid-row:2;min-height:44px;height:44px;border-radius:18px;padding:3px}
 #game-shell.touch-playing #auto-attack-button small{display:none}
 #game-shell.touch-playing .combat-controls .interaction-hint{display:none}
 #game-shell.touch-playing :is(.location,.control-tip,.coordinate){display:none}
 #game-shell.touch-playing .chat-panel:not(.expanded){width:80px;left:12px;right:auto;bottom:calc(8px + env(safe-area-inset-bottom))}
 #game-shell.touch-playing .chat-panel:not(.expanded) .chat-toggle{padding:6px;min-height:44px}
 #game-shell.touch-playing .chat-panel:not(.expanded) .chat-title{font-size:0;gap:0}
 #game-shell.touch-playing .chat-panel:not(.expanded) .chat-title::after{content:'แชต';font-size:12px}
 #game-shell.touch-playing .chat-panel:not(.expanded) kbd{display:none}
 #game-shell.touch-playing .chat-panel.expanded{bottom:8px;z-index:10;max-height:60dvh}
 #game-shell.touch-menu.touch-playing .touch-stick{bottom:calc(116px + env(safe-area-inset-bottom))}
 #game-shell.touch-menu.touch-playing .bottom-hud{bottom:calc(70px + env(safe-area-inset-bottom))}
 #game-shell.touch-menu.touch-playing .chat-panel:not(.expanded){bottom:calc(var(--mobile-nav-height) + 8px)}
}
/* Keep the chat launcher below the stick; the shared HUD stacking rule must
   not lift it into the walking controls on phones. */
@media(pointer:coarse){
 #game-shell.touch-playing .chat-panel:not(.expanded):not(.chat-keyboard){bottom:calc(8px + env(safe-area-inset-bottom,0px))}
 #game-shell.touch-playing.touch-menu .chat-panel:not(.expanded):not(.chat-keyboard){bottom:calc(var(--mobile-nav-height) + 8px)}
 #game-shell.touch-playing .chat-panel.expanded{z-index:21;max-width:calc(100% - 24px);max-height:calc(100dvh - 80px - var(--mobile-nav-height,0px));width:min(420px,calc(100% - 24px))}
 #game-shell.touch-playing .chat-panel.expanded:not(.sized) #chat-body{height:min(340px,50dvh);max-height:none}
 #game-shell.touch-playing .chat-panel.chat-keyboard.expanded{bottom:calc(var(--chat-keyboard-inset) + 8px);max-height:calc(var(--chat-viewport-height) - 16px)}
 #game-shell.touch-playing .chat-keyboard #chat-body{max-height:calc(var(--chat-viewport-height) - 62px)}
}
@media(max-height:500px) and (pointer:coarse), (max-height:500px) and (pointer:coarse){
 #game-shell.touch-playing .chat-panel.expanded:not(.sized) #chat-body{height:calc(100dvh - 100px)}
 #game-shell.touch-playing .chat-panel.expanded .chat-scope{display:none}
 #game-shell.touch-playing .chat-panel.expanded .chat-tabs button{min-height:32px}
 #game-shell.touch-playing .chat-panel.expanded .chat-footer{min-height:16px;padding-top:2px;padding-bottom:2px}
 #game-shell.touch-playing .chat-keyboard :is(.chat-scope,.chat-friends,.chat-footer){display:none}
 #game-shell.touch-playing .chat-keyboard .chat-tabs button{min-height:32px}
}
@media(pointer:coarse){
 #game-shell.touch-menu .chat-panel.expanded,#game-shell:not(.touch-playing) .chat-panel{bottom:calc(var(--mobile-nav-height) + 8px)}
}
@media(pointer:coarse) and (orientation:landscape), (pointer:coarse) and (orientation:landscape){
 #game-shell.touch-playing .touch-stick{bottom:calc(18px + env(safe-area-inset-bottom));width:104px;height:104px}
 #game-shell.touch-playing .chat-panel:not(.expanded){left:136px;bottom:8px}
 #game-shell.touch-playing:has(#world) #player-card{max-width:180px}
 #game-shell.touch-playing .target-card{top:64px;left:50%;width:170px;padding:6px 16px}
}
