/* Base HUD, contextual panels and responsive menus. Tactical controls below. */
.compact-hud:not(.game-active) .masthead{display:none}
.compact-hud #intro .intro-content{inset:0;transform:none;max-width:none;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;padding:0 20px max(32px,24dvh)}
.compact-hud #intro .intro-content>:not(h1):not(#load-status),.compact-hud #intro .intro-bottom,.compact-hud #intro .coordinates{display:none}
.compact-hud #intro h1{font-size:26px;line-height:1.5;letter-spacing:5px;margin:0 0 12px;text-shadow:0 2px 12px #07180d}
.compact-hud #intro .intro-shade{background:linear-gradient(0deg,#07180d70,#07180d20)}
.compact-hud #intro #load-status{margin:0;padding:10px 16px;font:12px/1.6 system-ui;letter-spacing:1px;color:#f1f4df;text-align:center;text-shadow:0 1px 5px #000;background:#10251b90;border-radius:10px}
.compact-hud #hud{--edge:18px;--control-inset:clamp(28px,5vw,64px);--control-bottom:max(clamp(32px,6dvh,52px),calc(env(safe-area-inset-bottom) + 16px));--rail:102px;--rail-top:82px;--dock-space:170px;font-family:system-ui,"Microsoft YaHei",sans-serif}
.touch-mode.compact-hud.game-active .masthead{padding:16px max(18px,env(safe-area-inset-right)) 0 max(18px,env(safe-area-inset-left))}
.compact-hud.game-active .brand{display:none}
.compact-hud.game-active .top-actions{margin-left:auto;gap:6px}.compact-hud.game-active .top-actions button{min-height:44px;border-radius:12px;padding:10px 14px;background:#10251bc7}
.compact-hud.game-active .top-actions .quiet span:last-child{display:inline}
.touch-mode.compact-hud #hud .glass{background:#10251ba8;border-color:#deedce32;border-radius:12px;box-shadow:0 3px 14px #06120c15}
.touch-mode.compact-hud #hud .hud-rail{padding:0;overflow:visible;height:auto;bottom:auto;gap:8px}
.touch-mode.compact-hud #hud #left-controls{top:max(16px,env(safe-area-inset-top));width:172px;pointer-events:none}
.touch-mode.compact-hud #hud .hud-rail .health-panel{padding:12px 14px;border:0;background:linear-gradient(110deg,#10251bc9,#10251b50);border-radius:12px}
.touch-mode.compact-hud #hud .hud-rail .health-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:11px;line-height:1.3}
.touch-mode.compact-hud #hud .hud-rail .health-title strong{font:500 12px/1.3 system-ui;white-space:nowrap}
.touch-mode.compact-hud #hud .hud-rail .health-track{height:4px;margin-top:5px;border-radius:4px;background:#fff2}
.touch-mode.compact-hud #hud .hud-rail .hunger-title,.touch-mode.compact-hud #hud .hud-rail .hydration-title{margin-top:10px}
.touch-mode.compact-hud #hud .health-panel #health-note{display:none}.touch-mode.compact-hud #hud .health-panel #health-note.urgent{display:block;margin:10px 0 0;color:#ffcf98;font-size:11px;line-height:1.4}
.touch-mode.compact-hud #hud #left-bottom-controls,.touch-mode.compact-hud #hud>.survival-actions,.touch-mode.compact-hud #hud>.weapon-tools,.touch-mode.compact-hud #hud>.utility-actions{display:none}
.touch-mode.compact-hud #hud #right-controls{top:84px;bottom:auto;max-height:none;width:102px}
.touch-mode.compact-hud #hud #right-controls>button{position:static;inset:auto;transform:none;width:100%;min-width:0;min-height:48px;padding:9px 7px;font-size:12px;line-height:1.4;text-align:center;border-radius:12px;touch-action:manipulation}
.touch-mode.compact-hud #hud #right-controls #market-menu{min-height:48px;display:block;background:#d8bd7c;color:#253022;border-color:#e6d19b}
.touch-mode.compact-hud #hud #market-menu strong{font-size:13px;letter-spacing:1px}.touch-mode.compact-hud #hud #market-menu small{display:none}
.touch-mode.compact-hud #hud #map-toggle span{font-size:12px;letter-spacing:0}
.touch-mode.compact-hud #hud #left-dock{width:120px;left:max(var(--control-inset),calc(env(safe-area-inset-left) + 16px));bottom:var(--control-bottom);gap:10px;flex-direction:column;align-items:flex-start}
.touch-mode.compact-hud #hud #left-dock .movement-actions{display:block;width:106px;flex:none}
.touch-mode.compact-hud #hud #left-dock .movement-actions button{width:100%;min-height:44px;font-size:12px;border-radius:22px}
.touch-mode.compact-hud #hud #left-dock .touch-controls{order:0;width:106px;align-items:center;gap:0}
.touch-mode.compact-hud #hud #joystick{width:106px;height:106px;background:radial-gradient(circle,#d5e4bd12,#10251b5e);border-color:#dceac754}
.touch-mode.compact-hud #hud #stick{width:42px;height:42px;background:#d5e3b975;border-color:#e8efd5a0}
.touch-mode.compact-hud #hud #move-hint{display:none}
.touch-mode.compact-hud #hud .combat-actions{right:max(var(--control-inset),calc(env(safe-area-inset-right) + 16px));bottom:var(--control-bottom);width:auto;display:flex;flex-direction:row-reverse;align-items:flex-end;gap:10px}
.touch-mode.compact-hud #hud .combat-actions #attack-button{width:90px;height:90px;min-height:90px;font-size:13px;line-height:1.5;border-radius:50%;background:#213d2ed1;border-color:#e2e8be70}
.touch-mode.compact-hud #hud .combat-actions #quick-heal{display:block;width:64px;min-height:48px;height:auto;padding:10px 6px;border-radius:16px;font-size:11px;text-align:center;margin-bottom:9px}
.touch-mode.compact-hud #hud .combat-actions #block-button{width:56px;min-height:48px;border-radius:16px;margin-bottom:9px}
.touch-mode.compact-hud #hud .combat-actions #block-button:disabled{display:none}
.touch-mode.compact-hud #hud #day-cycle{top:18px;left:50%;width:max-content;max-width:calc(100% - 390px);padding:7px 14px;min-width:0;border:0;background:#10251b7a;display:flex;flex-direction:column;gap:4px;border-radius:10px}
.touch-mode.compact-hud #hud #day-cycle strong{font-size:11px;line-height:1.4;white-space:nowrap;letter-spacing:0}
.touch-mode.compact-hud #hud #season-status{margin:0;padding:0;border:0}.touch-mode.compact-hud #hud #season-time{font-size:10px;color:#c7d7bd}
.touch-mode.compact-hud #hud .compass{left:50%;right:auto;top:86px;transform:translateX(-50%);gap:22px;font-size:10px;opacity:.85}.compact-hud #hud .compass b{top:14px}
.touch-mode.compact-hud #hud #craft-timer{top:116px;max-width:260px;width:max-content;padding:7px 12px;font-size:11px}
.touch-mode.compact-hud #hud #threat{top:156px;max-width:320px;width:max-content;font-size:12px}
.touch-mode.compact-hud #hud #toast{bottom:128px;width:max-content;max-width:min(420px,calc(100% - 300px));padding:10px 14px;font-size:12px;line-height:1.6;border-radius:10px;pointer-events:none}
.touch-mode.compact-hud #hud #animal-sounds{bottom:24px;width:min(290px,calc(100% - 400px));gap:8px}.compact-hud .animal-sound-cue{background:#10201955;box-shadow:none}.compact-hud .animal-sound-direction{display:none}
.touch-mode.compact-hud #hud #boss-panel{top:78px;width:min(400px,calc(100% - 420px));padding:12px 16px}
.touch-mode.compact-hud #hud #map-panel{top:76px;right:max(var(--edge),env(safe-area-inset-right));width:min(326px,calc(100% - 36px));max-height:calc(100dvh - 96px);bottom:auto;padding:14px;overflow:auto;background:#10251ef5;z-index:6}
.touch-mode.compact-hud #hud #map{width:100%;height:auto}.compact-hud #map-close{min-width:44px;min-height:44px}
.touch-mode.compact-hud #hud #context-controls{position:absolute;right:max(var(--edge),env(safe-area-inset-right));bottom:calc(var(--control-bottom) + 110px);width:224px;max-height:calc(100dvh - var(--control-bottom) - 202px);overflow:auto;display:flex;flex-direction:column;gap:8px;pointer-events:none;z-index:3;scrollbar-width:thin;overscroll-behavior:contain}
.touch-mode.compact-hud #hud #context-controls>*{position:static;inset:auto;transform:none;min-width:0;max-width:none;width:100%;pointer-events:auto;flex-shrink:0}
.touch-mode.compact-hud #hud #context-controls>button{min-height:48px;padding:10px 12px;font-size:12px;white-space:normal;border-radius:12px}
.touch-mode.compact-hud #hud #interact{background:#dce4b9ed;color:#233527;border-color:#edf0ce;line-height:1.5}
.touch-mode.compact-hud #hud #farm-panel,.touch-mode.compact-hud #hud #mining-panel{padding:12px;background:#10251ef2;font-size:11px}
.compact-hud .tool-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.compact-hud #hud .tool-heading button{width:auto;min-width:58px;min-height:44px;margin:0;border:0;background:#ffffff0c;border-radius:8px;color:#e1e9cc}
.compact-hud #context-controls button{touch-action:manipulation}.compact-hud #context-controls .farm-buttons{grid-template-columns:1fr 1fr}.compact-hud #context-controls .farm-buttons button,.compact-hud #farm-craft{min-height:44px}
.touch-mode.compact-hud #hud #placement-actions{display:flex;gap:8px}.compact-hud #placement-actions button{flex:1;min-height:44px}
.touch-mode.compact-hud #hud #placement-hint{bottom:118px;max-width:350px;font-size:11px}
.touch-mode.compact-hud #hud.tool-active #right-controls{visibility:hidden}
.compact-hud #field-menu{backdrop-filter:none;background:#08180fa6;justify-content:flex-end;padding:18px max(18px,env(safe-area-inset-right))}
.compact-hud #field-menu .field-card{width:min(430px,100%);max-height:calc(100dvh - 36px);padding:0;overflow:hidden;display:flex;flex-direction:column;border-radius:18px;background:#142b24fa}
.field-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:20px 22px 16px;border-bottom:1px solid #c3d7b225;flex-shrink:0}
.field-heading h2{font:500 22px/1.3 system-ui;margin:5px 0 0;letter-spacing:1px}.field-heading .eyebrow{font-size:9px;letter-spacing:2px}.field-heading button{min-height:44px;padding:10px 12px;white-space:nowrap;border-radius:10px}
.field-body{padding:0 22px 22px;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin}
.field-note{font-size:11px;color:#acbea3;margin:16px 0}.field-body h3{font-size:12px;font-weight:500;color:#c8d5b6;margin:22px 0 10px;letter-spacing:1px}
.field-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.compact-hud #field-menu .field-actions button{position:static;inset:auto;transform:none;display:block;width:100%;min-width:0;max-width:none;min-height:48px;height:auto;font:12px/1.5 system-ui;border:1px solid #bdd0a932;border-radius:10px;padding:10px 8px;color:#e5ecd8;background:#264333;text-align:center;letter-spacing:0;touch-action:pan-y}
.compact-hud #field-menu .field-actions button:hover:enabled{background:#34523c;border-color:#c5d6a95e}.compact-hud #field-menu .field-actions button:disabled{opacity:.38;cursor:not-allowed}.compact-hud #field-menu button[aria-pressed=true]{border-color:#c5d79c;background:#4c5e3d}
.compact-hud #field-menu .quickbar{position:static;inset:auto;transform:none;width:100%;grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.compact-hud #field-menu .quickbar small{display:block;font:10px system-ui;margin-top:4px;color:#b5c5a6}.compact-hud #field-menu kbd{display:none}
.field-status{margin-top:24px;border-top:1px solid #d1ddba25;color:#b9cbb1;font-size:11px;line-height:1.8}.field-status summary{padding:16px 0;min-height:44px;cursor:pointer;font-size:12px}
#field-details>small,#field-details>p{display:block;margin:0 0 10px;font:11px/1.8 system-ui;color:#b9cbb1}
.compact-hud #field-details .location,.compact-hud #field-details .mission{position:static;inset:auto;transform:none;width:auto;max-width:none;text-align:left;display:block;font:11px/1.8 system-ui;letter-spacing:0;background:none;border:0;padding:0;margin:12px 0}
.compact-hud #field-details .location small{display:inline-block;font-size:10px;margin:0 8px}.compact-hud #field-details .mission .eyebrow,.compact-hud #field-details .mission h2,.compact-hud #field-details .mission>small{display:none}.compact-hud #field-details .mission p{font-size:11px;text-align:left}.compact-hud #field-details #progress-dots{margin-top:8px}
@media(max-width:600px){
 .touch-mode.compact-hud #hud{--edge:12px;--rail:88px}
 .touch-mode.compact-hud.game-active .masthead{padding:10px 12px 0}.compact-hud.game-active .brand{font-size:15px;letter-spacing:1px;gap:7px}.compact-hud.game-active .brand svg{width:22px}.compact-hud.game-active .top-actions button{padding:8px 10px;font-size:11px}
 .touch-mode.compact-hud #hud #left-controls{top:max(10px,env(safe-area-inset-top));width:136px}.touch-mode.compact-hud #hud .hud-rail .health-panel{padding:10px}.touch-mode.compact-hud #hud .hud-rail .health-title{font-size:10px}.touch-mode.compact-hud #hud .hud-rail .health-title strong{font-size:11px}
 .touch-mode.compact-hud #hud #day-cycle{top:76px;left:auto;right:12px;transform:none;max-width:calc(100% - 172px);padding:7px 9px}.touch-mode.compact-hud #hud #day-cycle strong{font-size:10px}.touch-mode.compact-hud #hud #season-time{font-size:9px}
 .touch-mode.compact-hud #hud .compass{top:212px;gap:16px;font-size:9px}
 .touch-mode.compact-hud #hud #right-controls{top:154px;width:88px;gap:6px}.touch-mode.compact-hud #hud #right-controls>button{min-height:46px;font-size:11px}.touch-mode.compact-hud #hud #market-menu strong{font-size:12px}
 .touch-mode.compact-hud #hud #left-dock{width:106px}.touch-mode.compact-hud #hud #joystick{width:100px;height:100px}.touch-mode.compact-hud #hud #left-dock .touch-controls,.touch-mode.compact-hud #hud #left-dock .movement-actions{width:100px}
 .touch-mode.compact-hud #hud .combat-actions{gap:7px}.touch-mode.compact-hud #hud .combat-actions #attack-button{width:80px;height:80px;min-height:80px;font-size:12px}.touch-mode.compact-hud #hud .combat-actions #quick-heal{width:52px;font-size:10px}.touch-mode.compact-hud #hud .combat-actions #block-button{position:absolute;right:0;bottom:90px;width:80px;margin:0}
 .touch-mode.compact-hud #hud #context-controls{bottom:calc(var(--control-bottom) + 146px);width:188px;max-height:calc(100dvh - var(--control-bottom) - 280px)}
 .touch-mode.compact-hud #hud #toast{bottom:216px;max-width:calc(100% - 30px);font-size:11px;padding:8px 12px}.touch-mode.compact-hud #hud #craft-timer{top:244px;max-width:calc(100% - 220px);font-size:10px;left:14px;transform:none}.touch-mode.compact-hud #hud #threat{top:246px;left:14px;transform:none;max-width:calc(100% - 120px)}
 .touch-mode.compact-hud #hud #animal-sounds{bottom:calc(var(--control-bottom) + 124px);width:calc(100% - 40px);max-width:260px}.compact-hud .animal-sound-cue small{font-size:9px}
 .touch-mode.compact-hud #hud #boss-panel{top:70px;width:calc(100% - 24px);padding:10px 12px}.compact-hud.near-guardian #left-controls{visibility:hidden}
 .compact-hud #field-menu{padding:10px}.compact-hud #field-menu .field-card{max-height:calc(100dvh - 20px);width:100%}.field-heading{padding:16px}.field-body{padding:0 16px 18px}
}
@media(orientation:landscape) and (max-height:550px){
 .touch-mode.compact-hud #hud{--edge:12px;--rail:142px}
 .touch-mode.compact-hud.game-active .masthead{padding:8px 12px 0}.compact-hud.game-active .brand{font-size:15px}.compact-hud.game-active .top-actions button{padding:8px 12px}
 .touch-mode.compact-hud #hud #left-controls{top:max(8px,env(safe-area-inset-top));width:142px}.touch-mode.compact-hud #hud .hud-rail .health-panel{padding:8px 10px}.touch-mode.compact-hud #hud .hud-rail .hunger-title,.touch-mode.compact-hud #hud .hud-rail .hydration-title{margin-top:6px}
 .touch-mode.compact-hud #hud #right-controls{top:66px;width:142px;display:grid;grid-template-columns:1fr 1fr;gap:6px}.touch-mode.compact-hud #hud #right-controls>button,.touch-mode.compact-hud #hud #right-controls #market-menu{grid-column:auto;min-height:44px;font-size:10px;padding:6px}.touch-mode.compact-hud #hud #market-menu strong{font-size:11px}
 .touch-mode.compact-hud #hud #left-dock{flex-direction:row;align-items:flex-end;width:150px;gap:6px}.touch-mode.compact-hud #hud #left-dock .touch-controls{order:-1;width:88px}.touch-mode.compact-hud #hud #joystick{width:88px;height:88px}.touch-mode.compact-hud #hud #stick{width:36px;height:36px}.touch-mode.compact-hud #hud #left-dock .movement-actions{width:56px}.touch-mode.compact-hud #hud #left-dock .movement-actions button{font-size:10px}
 .touch-mode.compact-hud #hud .combat-actions{gap:7px}.touch-mode.compact-hud #hud .combat-actions #attack-button{width:76px;height:76px;min-height:76px;font-size:11px}.touch-mode.compact-hud #hud .combat-actions #quick-heal{width:54px;font-size:10px;margin:0}.touch-mode.compact-hud #hud .combat-actions #block-button{width:48px;font-size:10px;margin:0}
 .touch-mode.compact-hud #hud #day-cycle{top:10px;max-width:calc(100% - 340px);padding:5px 12px}.touch-mode.compact-hud #hud .compass{top:72px}.touch-mode.compact-hud #hud #craft-timer{top:98px}.touch-mode.compact-hud #hud #threat{top:130px}
 .touch-mode.compact-hud #hud #context-controls{bottom:calc(var(--control-bottom) + 86px);max-height:calc(100dvh - var(--control-bottom) - 146px);width:210px}.touch-mode.compact-hud #hud #animal-sounds{bottom:12px;width:calc(100% - 390px)}.touch-mode.compact-hud #hud #toast{bottom:100px;max-width:calc(100% - 350px);font-size:10px}
 .touch-mode.compact-hud #hud #boss-panel{top:60px;width:min(340px,calc(100% - 350px));padding:8px 12px}.compact-hud #boss-warning{font-size:11px}
 .compact-hud #field-menu{padding:10px}.compact-hud #field-menu .field-card{max-height:calc(100dvh - 20px);width:390px}.field-heading{padding:10px 16px}.field-heading h2{font-size:19px}.field-body{padding:0 16px 16px}.field-body h3{margin-top:16px}
}
/* Approved tactical touch layout. Local SVG masks preserve dynamic button text. */
.hud-button::before{content:"";display:block;flex:none;width:25px;height:25px;background:currentColor;-webkit-mask:var(--hud-icon) center/contain no-repeat;mask:var(--hud-icon) center/contain no-repeat;pointer-events:none}
.hud-button[data-count]:not([data-count=""])::after{content:attr(data-count);position:absolute;top:3px;right:6px;padding:0 2px;color:#f5f5e5;font:600 10px/1.2 system-ui;text-shadow:0 1px 3px #07110e;pointer-events:none}
.compact-hud.game-active .top-actions{gap:8px}.compact-hud.game-active .top-actions .hud-button{width:44px;height:44px;min-height:44px;padding:0;border-radius:50%;background:#10221c66;border:1px solid #e2e9d54d;font-size:0;justify-content:center}
.compact-hud.game-active .top-actions .hud-button>*{display:none!important}
.touch-mode.compact-hud #hud{--edge:clamp(20px,3vw,36px);--action:58px;--joy:106px;--attack:90px;--combat-width:224px}
.touch-mode.compact-hud #hud .glass{background:#12291c59;border-color:#e5efd255;box-shadow:none;backdrop-filter:none}
.touch-mode.compact-hud #hud .hud-button,.touch-mode.compact-hud #hud #right-controls>button{position:relative;inset:auto;transform:none;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:var(--action);height:var(--action);min-width:44px;min-height:44px;max-width:none;margin:0;padding:6px 3px;border-radius:50%;line-height:1.15;font-size:11px;letter-spacing:0;white-space:nowrap;text-align:center;pointer-events:auto;touch-action:manipulation;color:#f1f2dd;text-shadow:0 1px 3px #0b1b14}
.touch-mode.compact-hud #hud .hud-button:disabled{opacity:.4;cursor:not-allowed}
.touch-mode.compact-hud #hud .hud-button[aria-pressed=true]{border-color:#8ae7aa;color:#c6fbd3;background:#28523e80;box-shadow:inset 0 0 0 1px #8ae7aa30}
.touch-mode.compact-hud #hud .hud-button:active:enabled{background:#5c866276}
.touch-mode.compact-hud #hud .hud-rail .health-panel{padding:6px 0;border:0;background:none;border-radius:0;text-shadow:0 1px 3px #0b1813}
.touch-mode.compact-hud #hud #left-bottom-controls{display:flex;flex-direction:row;top:max(142px,calc(env(safe-area-inset-top) + 126px));left:max(var(--edge),env(safe-area-inset-left));bottom:auto;width:auto;max-height:none;gap:8px}
.touch-mode.compact-hud #hud #right-controls{display:grid;grid-template-columns:repeat(2,var(--action));top:84px;bottom:auto;max-height:none;width:auto;gap:9px}
.touch-mode.compact-hud #hud #right-controls #market-menu{grid-column:auto;display:flex;min-height:44px;background:#12291c59;color:#f1f2dd;border-color:#e5efd255}
.touch-mode.compact-hud #hud #market-menu::before{color:#dfcb83}
.touch-mode.compact-hud #hud #left-dock{width:172px;height:228px;display:block;pointer-events:none}
.touch-mode.compact-hud #hud #left-dock .movement-actions{position:absolute;inset:0;display:block;width:100%;pointer-events:none}
.touch-mode.compact-hud #hud #left-dock .touch-controls{position:absolute;left:0;bottom:0;display:block;width:var(--joy);pointer-events:none}
.touch-mode.compact-hud #hud #joystick{width:var(--joy);height:var(--joy);pointer-events:auto;background:#173b2226;border:1px solid #e8f1d46b;border-radius:50%;box-shadow:none;backdrop-filter:none}
.touch-mode.compact-hud #hud #stick{width:40%;height:40%;background:#e1e8c86b;border:1px solid #f3f5d66b;box-shadow:none}
.touch-mode.compact-hud #hud #left-dock #auto-walk{position:absolute;left:21px;right:auto;top:auto;bottom:132px;width:64px;height:64px;pointer-events:auto;font-size:10px}
.touch-mode.compact-hud #hud #left-dock #sprint{position:absolute;left:auto;top:auto;right:0;bottom:100px;width:52px;height:52px;pointer-events:auto}
.touch-mode.compact-hud #hud .combat-actions{width:var(--combat-width);height:214px;display:block;pointer-events:none}
.touch-mode.compact-hud #hud .combat-actions>.hud-button{position:absolute;width:54px;height:54px;min-height:44px;margin:0;pointer-events:auto}
.touch-mode.compact-hud #hud .combat-actions #attack-button{right:0;bottom:56px;width:var(--attack);height:var(--attack);min-height:var(--attack);font-size:15px;border-color:#f0f3d594;background:#203a2e69;gap:6px}
.touch-mode.compact-hud #hud #attack-button::before{width:34px;height:34px}
.touch-mode.compact-hud #hud .combat-actions #quick-heal{right:102px;bottom:62px;width:54px;height:54px;min-height:44px;padding:6px 3px;margin:0;display:flex;border-radius:50%}
.touch-mode.compact-hud #hud .combat-actions #block-button{right:164px;bottom:62px;width:54px;height:54px;margin:0;border-radius:50%}
.touch-mode.compact-hud #hud .combat-actions #block-button:disabled{display:flex}
.touch-mode.compact-hud #hud .combat-actions #spear-throw{right:102px;bottom:124px;font-size:10px}
.touch-mode.compact-hud #hud #weapon-slots{position:absolute;bottom:0;right:0;width:100%;display:grid;grid-template-columns:1fr 1fr;gap:8px;pointer-events:auto}
.touch-mode.compact-hud #hud #weapon-slots .hud-button{width:100%;height:44px;min-height:44px;border-radius:9px;flex-direction:row;gap:8px;font-size:12px;padding:6px 10px}
.touch-mode.compact-hud #hud #weapon-slots .hud-button[aria-pressed=true]{box-shadow:inset 0 -3px #8ae7aa;border-color:#e5efd255;background:#29493675;color:#eff8df}
.touch-mode.compact-hud #hud #weapon-slots .hud-button::after{top:3px;right:3px;font-size:9px}
.touch-mode.compact-hud #hud #day-cycle{top:55px;padding:0;border:0;background:none;text-shadow:0 1px 4px #07160d}
.touch-mode.compact-hud #hud .compass{top:19px;gap:42px}
.touch-mode.compact-hud #hud #context-controls{bottom:calc(var(--control-bottom) + 222px);max-height:calc(100dvh - var(--control-bottom) - 322px)}
.touch-mode.compact-hud #hud #boss-panel{top:110px}
.touch-mode.compact-hud #hud #toast{bottom:166px;max-width:min(420px,calc(100% - 380px))}
.touch-mode.compact-hud #hud #animal-sounds{width:min(260px,calc(100% - 480px))}
#bag-items{display:none}.inventory-mode #bag-items{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;padding:6px 0 20px}
.inventory-mode .craft-body>:not(#bag-items){display:none!important}
.bag-item{display:grid;grid-template-columns:1fr auto;gap:12px;padding:16px;border:1px solid #c5d9ae26;border-radius:12px;background:#203f30}.bag-item strong{font-size:13px}.bag-item span{font-size:12px;color:#c8d9bc}.bag-item button{grid-column:1/-1;min-height:44px;padding:8px;border:1px solid #c5d9ae40;border-radius:8px;background:#3f6046;font-size:12px}
@media(max-width:600px){
 .touch-mode.compact-hud #hud{--edge:18px;--action:48px;--joy:88px;--attack:72px;--combat-width:164px;--control-inset:24px;--control-bottom:max(32px,calc(env(safe-area-inset-bottom) + 16px))}
 .touch-mode.compact-hud #hud #left-controls{width:142px}
 .touch-mode.compact-hud #hud #left-bottom-controls{top:max(132px,calc(env(safe-area-inset-top) + 118px));gap:5px}
 .touch-mode.compact-hud #hud .hud-button,.touch-mode.compact-hud #hud #right-controls>button{font-size:10px}.touch-mode.compact-hud #hud .hud-button::before{width:22px;height:22px}
 .touch-mode.compact-hud #hud #right-controls{top:154px;gap:8px}
 .touch-mode.compact-hud #hud #day-cycle{top:76px;right:18px;max-width:calc(100% - 180px);text-align:right}.touch-mode.compact-hud #hud #day-cycle strong{font-size:9px}
 .touch-mode.compact-hud #hud .compass{top:202px;left:calc(50% - 8px);gap:20px;font-size:9px}
 .touch-mode.compact-hud #hud #left-dock{width:138px;height:200px}
 .touch-mode.compact-hud #hud #left-dock #auto-walk{left:17px;bottom:112px;width:54px;height:54px;font-size:9px}
 .touch-mode.compact-hud #hud #left-dock #sprint{right:0;bottom:66px;width:44px;height:44px;font-size:9px}
 .touch-mode.compact-hud #hud .combat-actions{height:196px}
 .touch-mode.compact-hud #hud .combat-actions #attack-button{bottom:54px;font-size:13px}
 .touch-mode.compact-hud #hud .combat-actions #quick-heal{right:80px;bottom:60px;width:44px;height:44px;font-size:10px}
 .touch-mode.compact-hud #hud .combat-actions #block-button{right:80px;bottom:112px;width:44px;height:44px;font-size:10px}
 .touch-mode.compact-hud #hud .combat-actions #spear-throw{right:0;bottom:134px;width:44px;height:44px;font-size:9px}
 .touch-mode.compact-hud #hud #weapon-slots{gap:6px}.touch-mode.compact-hud #hud #weapon-slots .hud-button{gap:5px;padding:5px 8px;font-size:11px}
 .touch-mode.compact-hud #hud #context-controls{bottom:calc(var(--control-bottom) + 204px);width:180px;max-height:calc(100dvh - var(--control-bottom) - 360px)}
 .touch-mode.compact-hud #hud #toast{bottom:244px;max-width:calc(100% - 36px)}
 .touch-mode.compact-hud #hud #craft-timer{top:228px;max-width:calc(100% - 160px);left:18px}.touch-mode.compact-hud #hud #threat{top:268px;left:18px;max-width:calc(100% - 160px)}
 .touch-mode.compact-hud #hud #animal-sounds{bottom:calc(var(--control-bottom) + 210px);width:calc(100% - 40px);max-width:250px}
 .touch-mode.compact-hud #hud #boss-panel{top:206px}
}
@media(max-width:360px){
 .touch-mode.compact-hud #hud{--control-inset:18px;--action:44px;--joy:80px;--attack:68px;--combat-width:148px}
 .touch-mode.compact-hud #hud #left-controls{width:132px}.touch-mode.compact-hud #hud #left-bottom-controls{gap:4px}
 .touch-mode.compact-hud #hud #right-controls{top:144px;gap:6px}
 .touch-mode.compact-hud #hud #left-dock{width:126px}.touch-mode.compact-hud #hud #left-dock #auto-walk{left:15px;width:50px;height:50px;bottom:104px}
 .touch-mode.compact-hud #hud #left-dock #sprint{bottom:54px}.touch-mode.compact-hud #hud #weapon-slots .hud-button{font-size:10px;gap:4px}
 .touch-mode.compact-hud #hud #day-cycle{max-width:158px;right:18px;top:72px}
}
@media(orientation:landscape) and (max-height:550px){
 .touch-mode.compact-hud #hud{--edge:24px;--action:44px;--joy:88px;--attack:72px;--combat-width:184px;--control-inset:clamp(28px,5vw,64px);--control-bottom:max(24px,calc(env(safe-area-inset-bottom) + 12px))}
 .touch-mode.compact-hud #hud #left-controls{width:148px}
 .touch-mode.compact-hud #hud .hud-rail .health-panel{padding:2px 0}
 .touch-mode.compact-hud #hud #left-bottom-controls{top:110px;gap:6px}
 .touch-mode.compact-hud #hud .hud-button,.touch-mode.compact-hud #hud #right-controls>button{font-size:9px;gap:2px;padding:3px}.touch-mode.compact-hud #hud .hud-button::before{width:21px;height:21px}
 .touch-mode.compact-hud #hud #right-controls{top:60px;gap:6px}
 .touch-mode.compact-hud #hud #left-dock{width:152px;height:188px}
 .touch-mode.compact-hud #hud #left-dock #auto-walk{left:19px;bottom:116px;width:50px;height:50px;font-size:9px}
 .touch-mode.compact-hud #hud #left-dock #sprint{right:0;bottom:68px;width:44px;height:44px}
 .touch-mode.compact-hud #hud .combat-actions{height:182px}
 .touch-mode.compact-hud #hud .combat-actions #attack-button{bottom:52px;font-size:13px}.touch-mode.compact-hud #hud #attack-button::before{width:28px;height:28px}
 .touch-mode.compact-hud #hud .combat-actions #quick-heal{right:80px;bottom:56px;width:44px;height:44px;font-size:9px}
 .touch-mode.compact-hud #hud .combat-actions #block-button{right:130px;bottom:56px;width:44px;height:44px;font-size:9px}
 .touch-mode.compact-hud #hud .combat-actions #spear-throw{right:130px;bottom:108px;width:44px;height:44px;font-size:9px}
 .touch-mode.compact-hud #hud #weapon-slots .hud-button{font-size:10px;padding:5px 8px;gap:7px}
 .touch-mode.compact-hud #hud #day-cycle{top:45px;left:50%;right:auto;transform:translateX(-50%);max-width:calc(100% - 370px);gap:2px;text-align:center}.touch-mode.compact-hud #hud #day-cycle strong{font-size:10px}
 .touch-mode.compact-hud #hud .compass{top:12px;left:50%;gap:32px}
 .touch-mode.compact-hud #hud #context-controls{right:calc(var(--control-inset) + 198px);bottom:calc(var(--control-bottom) + 54px);width:184px;max-height:calc(100dvh - 156px)}
 .touch-mode.compact-hud #hud.tool-active #context-controls{right:max(var(--edge),env(safe-area-inset-right));top:60px;bottom:auto;width:204px;max-height:calc(100dvh - var(--control-bottom) - 192px)}
 .touch-mode.compact-hud #hud #animal-sounds{bottom:8px;width:calc(100% - 450px)}.touch-mode.compact-hud #hud #toast{bottom:90px;max-width:calc(100% - 440px);font-size:10px;padding:6px 10px}
 .touch-mode.compact-hud #hud #boss-panel{top:90px;width:min(340px,calc(100% - 400px))}
}
/* Inventory preview implementation: fixed categories, independently scrolling items. */
#bag-filters{display:none}.inventory-mode #bag-filters{display:flex;gap:8px;margin-top:8px;overflow-x:auto;flex-shrink:0}
#bag-filters button{min-height:44px;min-width:54px;padding:10px 18px;border:0;border-radius:0;background:transparent;color:#ccd9be;font-size:13px;white-space:nowrap}
#bag-filters button[aria-pressed=true]{color:#effbdd;box-shadow:inset 0 -3px #8ae7aa}
.inventory-mode #craft-market,.inventory-mode .craft-heading .eyebrow{display:none}
.inventory-mode .craft-card{width:min(1050px,calc(100vw - 36px));max-height:90dvh;padding:0;border-radius:18px;background:#142b24f5}
.inventory-mode .craft-toolbar{padding:18px 22px 0}.inventory-mode .craft-heading h2{margin:0;font:500 25px/1.4 system-ui}
.inventory-mode #bag-items{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:0 0 6px}
.bag-item{position:relative;display:flex;flex-direction:column;gap:6px;padding:14px 12px 12px 46px;min-height:108px;background:#233e2d99;border:1px solid #d0dfbb3b;border-radius:12px}
.bag-item strong{font-size:12px;line-height:1.4}.bag-item .bag-count{font-size:12px;color:#dce8cd}.bag-item small{font-size:10px;line-height:1.4;color:#b1c6a4}
.bag-item .bag-icon{position:absolute;left:12px;top:16px;color:#dfebd1}.bag-icon::before{width:25px;height:25px}
.bag-item button{margin:6px 0 0 -34px;min-height:44px;border-radius:8px;font-size:12px;background:#34543b}
.bag-empty{grid-column:1/-1;padding:40px 12px;text-align:center;font-size:13px;color:#b7caae}
@media(max-width:1000px){.inventory-mode #bag-items{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:600px){.inventory-mode .craft-card{width:100%;max-height:94dvh;border-radius:12px}.inventory-mode .craft-toolbar{padding:12px 14px 0}.inventory-mode #bag-items{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}#bag-filters{gap:0}#bag-filters button{min-width:44px;flex:1;padding:10px 6px;font-size:12px}.bag-item{padding:12px 10px 10px 38px}.bag-item .bag-icon{left:8px}.bag-icon::before{width:22px;height:22px}.bag-item button{margin-left:-28px}}
@media(max-height:550px){.inventory-mode .craft-toolbar{padding:8px 16px 0}.inventory-mode .craft-heading h2{font-size:20px}.inventory-mode #bag-filters{margin-top:0}.inventory-mode #bag-items{gap:8px}.bag-item{min-height:90px}}
@media(orientation:landscape) and (max-height:360px){
 .touch-mode.compact-hud #hud #left-bottom-controls{top:100px}
 .touch-mode.compact-hud #hud #right-controls{grid-template-columns:repeat(3,var(--action));top:58px}
 .touch-mode.compact-hud #hud #left-dock #auto-walk{left:22px;bottom:96px;width:44px;height:44px;font-size:8px}
 .touch-mode.compact-hud #hud #left-dock #sprint{bottom:6px}
 .touch-mode.compact-hud #hud .combat-actions #spear-throw{right:146px}
}
.inventory-mode #bag-filters,.inventory-mode .craft-body{scrollbar-width:thin;scrollbar-color:#8fa47c66 #142b24;touch-action:pan-y}
@media(max-width:600px){.inventory-mode #bag-filters{gap:0;overflow-x:hidden}.inventory-mode #bag-filters button{min-width:44px;flex:1;padding:10px 4px}}
/* Workbench follows the same panel system as the backpack; recipes lead the page. */
#craft .craft-card{width:min(1050px,calc(100vw - 32px));max-height:calc(100dvh - 24px);border-radius:16px;background:#142b24f5}
#craft .craft-toolbar{padding:14px 20px 0}#craft .craft-body{padding:16px 20px;scrollbar-width:thin;scrollbar-color:#8fa47c66 #142b24;touch-action:pan-y}
#craft .craft-heading{gap:12px;min-height:44px}#craft .craft-heading h2{font:500 24px/1.3 system-ui;margin:0}
.craft-title-group,.craft-header-actions{display:flex;align-items:center;gap:14px}.craft-title-group{flex-wrap:wrap;gap:5px 14px}.craft-title-group small{font-size:13px;color:#b7caae}
#workshop-details-toggle{min-height:44px;padding:9px 14px;border:1px solid #d4e4bf66;border-radius:8px;color:#e5efd7;background:transparent;font:12px system-ui;white-space:nowrap}
#workshop-details-toggle[aria-expanded=true]{background:#34543b;border-color:#8ae7aa}
#craft .menu-resume{min-height:44px;padding:9px 15px;font-size:13px;border-radius:8px}#craft:not(.inventory-mode) .menu-resume span{display:none}
.craft-status-row{display:flex;align-items:center;gap:10px;min-height:40px}.craft-status-row #bench-status{flex:1;min-width:0;margin:4px 0;font-size:11px;line-height:1.5;color:#b6c9b3}
#craft #craft-market{width:auto;min-height:44px;padding:8px 10px;font-size:12px;border:0;color:#cce8c9;background:transparent;border-radius:6px;white-space:nowrap}
#craft #bench-route{min-height:44px;padding:6px 8px;font-size:11px;white-space:nowrap}
#craft .craft-tabs{display:flex;flex-wrap:nowrap;gap:4px;margin:0;overflow-x:auto;scrollbar-width:thin;scrollbar-color:#8fa47c66 #142b24;touch-action:pan-x}
#craft .craft-tabs button{flex:1;min-width:48px;min-height:44px;border:0;border-radius:0;padding:9px 10px;color:#bfcfb3;background:transparent;white-space:nowrap;font-size:13px}
#craft .craft-tabs button.active{background:transparent;color:#ddf8d9;box-shadow:inset 0 -3px #8ae7aa}
#craft #recipe-list{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:0;min-height:0}
#craft .recipe-card{display:flex;flex-direction:column;padding:16px;background:#233e2d99;border:1px solid #d0dfbb3b;border-radius:12px}
#craft .recipe-card h3{display:flex;align-items:center;gap:9px;margin:0 0 10px;font-size:14px;font-weight:600;letter-spacing:0;line-height:1.4;color:#ecf4e2}
#craft .recipe-card h3::before{width:26px;height:26px;flex-shrink:0}#craft .recipe-card p{font-size:12px;line-height:1.6;color:#b9cbb0;margin:0 0 8px}
#craft .recipe-card small{font-size:11px;line-height:1.6;color:#d5d3ab}
#craft .recipe-actions{margin-top:auto;padding-top:12px;gap:8px}#craft .recipe-actions button{min-height:44px;font-size:12px;border-radius:7px;background:#a8e5b0;border-color:#a8e5b0;color:#152d21;padding:8px}
#craft .recipe-actions .use-item{color:#d6e7ca;border-color:#b5c99e66;background:transparent}#craft .recipe-actions button:disabled{opacity:.45}
#craft .recipe-card.locked{background:#1b302699;border-style:dashed}#craft .recipe-card.locked h3{color:#b9c6ae}
#craft #workshop-details{margin-bottom:16px;border-bottom:1px solid #d0dfbb3b;padding-bottom:12px}#craft .workshop-upgrade{margin:0;border-radius:10px;background:#284432}
.workshop-materials{margin-top:12px;font-size:12px;color:#bbcfae}.workshop-materials summary{min-height:44px;display:flex;align-items:center;cursor:pointer}.workshop-materials summary::before{content:'▸';margin-right:8px}.workshop-materials[open] summary::before{content:'▾'}
#craft #craft-job{margin:0 0 14px;border-color:#8ae7aa66}#craft .craft-tip{margin:14px 0 0;font-size:11px}
#craft.inventory-mode .craft-status-row,#craft.inventory-mode .craft-tabs,#craft.inventory-mode #workshop-details-toggle,#craft.inventory-mode #craft-level{display:none}
@media(max-width:900px){#craft #recipe-list{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){#craft .craft-card{width:calc(100vw - 20px)}#craft .craft-toolbar{padding:10px 12px 0}#craft .craft-body{padding:12px}#craft .craft-heading{gap:8px}#craft .craft-heading h2{font-size:19px}.craft-title-group small{font-size:11px}.craft-header-actions{gap:6px}#workshop-details-toggle{padding:8px;font-size:11px}#craft .menu-resume{padding:8px 10px;font-size:12px}#craft .craft-tabs{gap:0}#craft .craft-tabs button{padding:8px 5px;font-size:12px}#craft .recipe-card{padding:12px}}
@media(max-width:540px){#craft #recipe-list{grid-template-columns:1fr}.craft-title-group{flex-direction:column;align-items:flex-start;gap:2px}.craft-status-row{gap:4px}#craft #bench-status{font-size:10px}#craft .workshop-upgrade{flex-direction:column;align-items:stretch}#craft .workshop-upgrade p{max-width:none;font-size:11px}#craft .workshop-upgrade button{min-height:44px}}
@media(orientation:landscape) and (max-height:550px){#craft .craft-toolbar{padding-top:8px}#craft .craft-heading h2{font-size:20px}#craft .craft-body{padding-top:10px}#craft .recipe-card{padding:12px}#craft .recipe-card h3{font-size:13px;margin-bottom:7px}#craft .recipe-card p{font-size:11px}#craft .recipe-actions{padding-top:9px}#craft .craft-status-row{min-height:30px}#craft #craft-market,#craft #bench-route{min-height:44px}#craft .craft-tip{display:none}}
/* Game controls must never open image/text callouts during a held touch. */
#world,#hud,button,canvas{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
.touch-mode.compact-hud #hud #right-controls>button,.touch-mode.compact-hud #hud #left-bottom-controls>button{touch-action:none}
