@import "./fonts/hud.css";
#gameFrame{position:fixed;top:0;left:0;width:100vw;height:100vh;height:100dvh;container:game / size;overflow:hidden;--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px);--safe-top:env(safe-area-inset-top,0px);--safe-bottom-inset:env(safe-area-inset-bottom,0px);--safe-bottom:max(8px,var(--safe-bottom-inset))}
body[data-rotated=true] #gameFrame{width:100vh;width:100dvh;height:100vw;transform-origin:0 0;transform:translateX(100vw) rotate(90deg);--safe-left:env(safe-area-inset-top,0px);--safe-top:env(safe-area-inset-right,0px);--safe-right:env(safe-area-inset-bottom,0px);--safe-bottom-inset:env(safe-area-inset-left,0px)}
:root{color-scheme:dark;font-family:"Atkinson Hyperlegible Next","Microsoft YaHei","Noto Sans CJK SC",system-ui,sans-serif;color:#f7f3e5;--line:#22241d;--panel:#353b31;--light:#aeb39d;--shadow:#22271e;--focus:#ffdb8b;--slot:clamp(34px,5.2cqw,57px)}
*,*:before,*:after{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden}body{background:#1f302d}button,input{font:inherit}button{cursor:pointer}button:disabled{cursor:default;opacity:.53}button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid var(--focus);outline-offset:2px}button{color:inherit}h1,h2,h3,p{margin:0}button,input,label{touch-action:manipulation}button{-webkit-tap-highlight-color:transparent}[hidden]{display:none!important}
#world,.backdrop,.screen,#hud{position:fixed;inset:0;width:100%;height:100%;height:100cqh}
#world{display:block;outline:none;touch-action:none;z-index:0}.backdrop{z-index:1;background:#83a9ab url(./panorama.webp) center 53%/cover no-repeat;image-rendering:pixelated;pointer-events:none}
.backdrop:before,.backdrop:after{content:"";position:absolute;inset:0}.backdrop:before{background:linear-gradient(90deg,#0b1b1bc2,#1428209c 24%,#1428202b 51%,transparent 76%)}.backdrop:after{background:linear-gradient(0deg,#18271dcc,transparent 18%,transparent 86%,#233c3a24)}
body:not([data-screen=home]) .backdrop:before{background:#142021a8}body[data-in-game=true] .backdrop{display:none}.screen{z-index:2;overflow:auto}.home{display:flex;align-items:center}.home-content{width:min(382px,85cqw);margin-left:clamp(40px,9.5cqw,180px);padding:30px 0 72px}.home h1{margin:0 0 clamp(22px,4cqh,42px);line-height:0}.home h1{position:relative;line-height:1;font:900 clamp(36px,5cqw,60px)/1 monospace;color:#e4e2cf}.home h1 canvas{display:none;width:100%;height:auto;image-rendering:pixelated;filter:drop-shadow(2px 4px 0 #1b281b80)}.home h1.painted canvas{display:block}.home h1.painted span{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
.home-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.home-actions>button:first-child{grid-column:1/-1}.stone{font-weight:700;font-size:16px;line-height:1.25;color:#fbfaee;text-shadow:1px 2px #2f372b;min-height:42px;padding:9px 14px;border:3px solid #20241d;border-radius:0;box-shadow:inset 2px 2px #a6ad97,inset -2px -2px #4b5147,0 2px 0 #131c1b77;background-color:#6b7266;background-image:linear-gradient(135deg,#ffffff0a 25%,transparent 25%,transparent 65%,#10170a0a 65%),linear-gradient(#757e6e,#646d60);background-size:11px 9px,100% 100%;display:inline-flex;align-items:center;justify-content:center;gap:9px}
.stone.primary{background-color:#638243;background-image:linear-gradient(135deg,#e8ffc00b 27%,transparent 27%,transparent 65%,#162b0c0a 65%),linear-gradient(#789b50,#5f813f);box-shadow:inset 2px 2px #accb7c,inset -2px -2px #3d5c2c,0 2px 0 #18201499}.stone:hover:not(:disabled),.preset:hover,.world-card:hover{filter:brightness(1.14)}.stone:active:not(:disabled){transform:translateY(1px);box-shadow:inset 2px 2px #4a5442,inset -1px -1px #a3ad96}
.home-actions .primary{min-height:62px;font-size:23px;letter-spacing:.08em;padding-inline:16px;justify-content:flex-start}.home-actions>.stone:not(.primary){min-height:46px;font-size:15px}.key{margin-left:auto;border:1px solid #d2dfa661;background:#394a2870;padding:3px 6px;color:#eaf0d7;font:12px/1.15 "Courier New",monospace;letter-spacing:0;text-shadow:none}.pixel-icon{display:inline-flex;width:22px;height:22px;align-items:center;justify-content:center;flex:none}.pixel-icon svg{width:100%;height:100%;fill:currentColor;shape-rendering:crispEdges}.home-actions .primary .pixel-icon{width:26px;height:26px}
.recent{display:flex;width:100%;text-align:left;gap:13px;align-items:center;padding:12px 4px 3px;margin-top:17px;background:none;border:0;border-top:1px solid #c7d6b478;text-shadow:1px 2px #142219}.recent small,.recent strong{display:block}.recent small{font-size:12px;color:#d3dfc7}.recent strong{font-size:15px;margin-top:2px}.recent b{margin-left:auto;font-size:24px}
.home-footer{position:absolute;bottom:max(20px,var(--safe-bottom));left:clamp(22px,4.5cqw,78px);right:clamp(22px,4.5cqw,78px);display:flex;justify-content:space-between;align-items:center;color:#e0e5d1;text-shadow:1px 1px #2a3728;font-size:12px;letter-spacing:.07em}.local-dot{display:inline-block;width:7px;height:7px;background:#b0ca78;border:1px solid #48553c;margin-right:4px}
.centered{display:flex;align-items:center;justify-content:center;padding:clamp(10px,2.4cqw,36px)}.overlay{background:#0d1513a8}.window{background:linear-gradient(#41483b,#343b31);border:3px solid var(--line);box-shadow:inset 2px 2px #828a73,inset -2px -2px #20271e,5px 7px 0 #11201655;width:min(620px,100%);max-height:94cqh;overflow:auto;overscroll-behavior:contain;padding:clamp(17px,3cqw,30px);scrollbar-color:#859275 #30382d}.narrow{max-width:430px}.head,.bag-head,.seed-row,.segmented,.bag-tabs,.bag-ops{display:flex;align-items:center;gap:8px}.head{justify-content:space-between;border-bottom:1px solid #66705c;padding-bottom:14px;margin-bottom:17px}.head h2{font-size:clamp(21px,3cqw,29px);line-height:1.16;text-shadow:2px 2px #252c23}.small{min-height:33px;font-size:13px;padding:5px 10px}.wide{width:100%;margin-top:16px}.fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}label,legend,.bag-head h3{font-size:14px;font-weight:650}.fields label{display:grid;gap:5px}input[type=text],input[type=search]{width:100%;min-width:0;background:#22291f;border:2px solid #151b14;box-shadow:inset 1px 1px #151a13,0 1px #79836c;padding:8px 9px;color:#fffbee;font-size:15px}.seed-row{gap:3px}.seed-row button{flex:none}fieldset{border:0;margin:17px 0 0;padding:0}legend{padding:0 0 8px}.preset-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.preset,.segmented label{position:relative;cursor:pointer;display:flex;align-items:center;gap:7px;min-height:45px;padding:3px 8px;border:2px solid #252c21;background:#4d5648;box-shadow:inset 1px 1px #6d7861}.preset input,.segmented input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;margin:0}.preset canvas{width:38px;height:38px;image-rendering:pixelated}.preset:has(:checked),.segmented label:has(:checked),.bag-tabs [aria-pressed=true]{background:#536948;color:#f2f8e6;box-shadow:inset 0 0 0 2px #b6ce91}.preset:focus-within,.segmented label:focus-within{outline:2px solid var(--focus)}.segmented label{flex:1;justify-content:center;min-height:35px}.mode-note,.help-note,.empty,#pauseWorld{color:#d3dbca;font-size:14px;line-height:1.55;margin:9px 0}.pause-actions{display:grid;gap:7px}.help-list{margin:0}.help-list div{display:flex;align-items:center;justify-content:space-between;gap:6px;border-bottom:1px solid #58624f;padding:9px 0;font-size:14px}.help-list dd{margin:0;text-align:right;color:#e0e9d3}
.world-list{display:grid;gap:7px;max-height:52cqh;overflow:auto}.world-card{width:100%;display:flex;align-items:center;gap:12px;text-align:left;padding:8px;background:#2b3329;color:#edf2de;border:2px solid #1e261b;box-shadow:inset 1px 1px #63705a}.world-card canvas{width:49px;height:49px;image-rendering:pixelated;background:#404e39}.world-card strong,.world-card small{display:block}.world-card small{color:#b9c7ad;font-size:13px;margin-top:3px}.world-card strong{font-size:17px}.world-card .play-mark{margin-left:auto;color:#b7cd97;font-size:14px;white-space:nowrap}.world-card>span:first-of-type{min-width:0;overflow-wrap:anywhere}
#hud{z-index:2;pointer-events:none;user-select:none}#hud button{pointer-events:auto}.hud-top{position:absolute;left:max(10px,var(--safe-left));top:max(10px,var(--safe-top));display:flex;align-items:center;gap:5px}.hud-button,#touchHud button{background:#273029b5;border:1px solid #131a14;box-shadow:inset 1px 1px #d6e2c66b,inset -1px -1px #273125;padding:6px 8px;font-size:13px;font-weight:700;text-shadow:1px 1px #111a12}.hud-top output{font:13px/1.1 monospace;color:white;text-shadow:1px 1px #141c16;padding:2px 4px}#crosshair{position:absolute;left:50%;top:50%;width:15px;height:15px;transform:translate(-50%,-50%);filter:drop-shadow(1px 1px #2228)}#crosshair:before,#crosshair:after{content:"";position:absolute;background:#fff}#crosshair:before{left:6px;top:0;width:3px;height:15px}#crosshair:after{left:0;top:6px;width:15px;height:3px}#target{position:absolute;left:50%;top:calc(50% + 18px);transform:translateX(-50%);background:#1c241dc7;text-align:center;padding:3px 8px;font-size:13px}#target progress{display:block;width:100%;height:5px;accent-color:#b0d676;margin:3px 0}
.hud-belt{position:absolute;bottom:var(--safe-bottom);left:50%;transform:translateX(-50%)}.hud-row{display:flex;align-items:stretch;position:relative}#hudBag{display:grid;place-items:center;padding:3px 6px}#hudBag .cue-pixel,#beltBag .cue-pixel{display:block;width:24px;height:24px}#heldName{display:block;text-align:center;min-height:1.35em;font-weight:650;font-size:15px;color:#fff;text-shadow:1px 2px #232826}.vitals{display:flex;justify-content:space-between;gap:10px;margin:1px 2px 4px}.vitals>div{display:flex;gap:1px}.vitals span{height:14px;width:14px;display:inline-block;position:relative;background:#3c332d;filter:drop-shadow(1px 1px #262018)}.vitals #health span{clip-path:polygon(0 15%,15% 15%,15% 0,40% 0,50% 19%,60% 0,85% 0,85% 15%,100% 15%,100% 50%,50% 100%,0 50%)}.vitals #food span{clip-path:polygon(55% 0,86% 0,100% 13%,100% 45%,82% 67%,63% 67%,40% 91%,43% 100%,13% 100%,0 85%,17% 67%,26% 69%,44% 48%,42% 21%)}.vitals span:after{content:"";position:absolute;inset:1px;clip-path:inherit;background:#ce5b4b}.vitals #food span:after{background:#d8a163}.vitals [data-fill="0"]:after{display:none}.vitals [data-fill="1"]:after{width:50%}
.slots-grid{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));background:#252c24;border:2px solid #181d17}.slot{isolation:isolate;position:relative;display:grid;place-items:center;min-width:0;margin:0;padding:1px;background:#737a69;border:1px solid #4a5446;box-shadow:inset 1px 1px #a2aa96,inset -1px -1px #4c5847;color:#fff;aspect-ratio:1}.slot canvas,.creative-choice canvas,.recipe canvas{width:73%;height:73%;image-rendering:pixelated}.slot[aria-pressed=true],.slot.picked{z-index:1;outline:2px solid #ecf3cd;outline-offset:-2px;background:#7c9065}.slot.picked{outline-color:var(--focus)}.slot small{position:absolute;top:1px;left:3px;font:10px/1 monospace;text-shadow:1px 1px #222}.slot .count{position:absolute;bottom:1px;right:3px;font:bold 13px/1 monospace;text-shadow:1px 1px #171d15,0 1px #151a14}.wear{position:absolute;bottom:2px;left:12%;width:76%;height:3px;background:#2a3324;box-shadow:0 1px #1a2116}.wear b{display:block;height:100%;background:#b2cc6e}#hotbar{grid-template-columns:repeat(9,var(--slot))}#hotbar .slot{background:#414d3ecf;box-shadow:inset 2px 2px #a9b09c99,inset -2px -2px #394333}#hotbar [aria-pressed=true]{outline:3px solid #f2f2df;outline-offset:-1px;background:#68765bdc}.bag{width:min(585px,100%)}.bag .head{margin-bottom:10px}.bag-head{justify-content:space-between;margin:9px 0 4px}.bag-head span{font-size:13px;color:#e0dfb6}.bag-ops{margin-top:10px;justify-content:flex-end}.bag-tabs{flex-wrap:wrap;margin-bottom:8px}.bag-tabs button{min-height:32px}.bag-tools{display:flex;gap:5px;align-items:center;margin-bottom:7px}.bag-tools input{flex:1}.bag-tools select{color:#ebf0e2;background:#2b3528;border:1px solid #73816a;min-height:33px}.catalog-grid{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:2px;max-height:25cqh;overflow-y:auto;background:#2d352a}.creative-choice,.recipe{background:#4c5848;color:#edf1e1;border:1px solid #2b3428;box-shadow:inset 1px 1px #6e7b65;min-width:0}.creative-choice{display:grid;place-items:center;aspect-ratio:1}.recipe-list{display:grid;gap:3px;max-height:23cqh;overflow:auto}.recipe{display:flex;align-items:center;text-align:left;gap:8px;padding:5px}.recipe canvas{width:30px;height:30px;flex:none}.recipe small{display:block;color:#d4dfcd}.machine{padding:8px;background:#2a3328;border:1px solid #607057;font-size:14px}.machine progress{vertical-align:middle;margin:0 5px;width:100px;accent-color:#eab96b}.machine .stone{margin-bottom:7px}.bag-hint{font-size:13px;line-height:1.4;color:#d3dccb;margin:5px 0}
#touchHud{display:none}#toast{position:fixed;bottom:calc(var(--slot) + var(--safe-bottom) + 49px);left:50%;transform:translateX(-50%);max-width:85cqw;z-index:5;background:#222a21e8;padding:5px 10px;font-size:14px;text-align:center;pointer-events:none}#toast:empty{display:none}
@container game (max-width:650px){.home-content{margin-left:8%;width:min(360px,84cqw)}.home-actions .primary{font-size:20px;min-height:54px}.fields{grid-template-columns:1fr}.preset-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.window{padding:16px}.preset{min-height:39px}.preset canvas{width:31px;height:31px}.vitals span{width:11px;height:11px}.bag-head span{font-size:12px}.catalog-grid{grid-template-columns:repeat(7,minmax(0,1fr))}#hudBag{position:static}.home-footer{font-size:11px}}
@container game (max-height:560px) and (orientation:landscape){.home-content{padding:12px 0 32px;width:300px}.home h1{margin-bottom:10px}.home-actions .primary{min-height:41px;font-size:18px}.home-actions>.stone:not(.primary){min-height:35px;padding:5px}.recent{margin-top:7px;padding-top:5px}.home-footer{bottom:6px}.window{padding:12px;max-height:96cqh}.fields{grid-template-columns:1fr 1fr}.preset-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.header{margin-bottom:6px}.bag .slot{aspect-ratio:auto;height:32px}.catalog-grid,.recipe-list{max-height:21cqh}}
@container game (max-width:390px){#hud{--slot:8.9cqw}.home-actions .stone{padding-inline:6px}.hud-top output{font-size:11px}}
.rules{margin-top:14px;font-size:14px;color:#dbe4d2}.rules summary{cursor:pointer}.rule-options{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:9px 0}.rule-options select{font:inherit;color:#f1f2df;background:#2b3427}.rule-options input{accent-color:#99b772}#wallet{margin-left:auto;color:#f1cf80;font-size:14px}
.creative-choice{aspect-ratio:auto;min-height:55px;grid-template-rows:31px auto;align-content:center;gap:1px;padding:3px 1px}.creative-choice canvas{width:29px;height:29px}.creative-choice span{max-width:100%;overflow-wrap:anywhere;font-size:12px;line-height:1.12}

.home-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
.home-actions>button.mode-entry{grid-column:auto;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;gap:9px;min-height:112px;padding:12px 14px;text-align:left}
.home-actions .mode-entry .pixel-icon{width:23px;height:23px}.mode-entry>span{display:grid;max-width:100%;gap:3px}
.mode-entry strong{font-size:21px;letter-spacing:.05em;line-height:1.15}.mode-entry small{display:block;color:#ecf0de;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:0}
.home-actions .creative-entry{background-color:#697d72;background-image:linear-gradient(135deg,#ffffff0a 25%,transparent 25%,transparent 65%,#10170a0a 65%),linear-gradient(#788b7f,#5c7063);box-shadow:inset 2px 2px #b0c1ad,inset -2px -2px #465748,0 2px 0 #18201499}
.home-actions #homeHelp{grid-column:1/-1;min-height:38px}
@container game (max-height:560px) and (orientation:landscape){.home-actions>button.mode-entry{min-height:67px;gap:3px;padding:6px 9px}.home-actions .mode-entry .pixel-icon{display:inline-flex;width:18px;height:18px}.mode-entry strong{font-size:17px}.home-actions #homeHelp{min-height:29px}}
body[data-screen=play]:not([data-overview=true]) #world{cursor:none}
body[data-screen=play][data-overview=true] #world{cursor:grab}

.vitals [data-fill="1"]:after{width:auto;background:linear-gradient(90deg,#ce5b4b 50%,transparent 50%)}
.vitals #food [data-fill="1"]:after{background:linear-gradient(90deg,#d8a163 50%,transparent 50%)}
@container game (max-height:560px) and (orientation:landscape){
 .home-actions>button.mode-entry{flex-direction:row;align-items:center;justify-content:flex-start;gap:8px}
}

.slot canvas{object-fit:contain}
@container game (min-width:680px) and (max-height:520px) and (orientation:landscape){
 .window.bag{width:min(900px,100%)}
 .bag-panes{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.14fr);gap:16px}
 .bag-storage .bag-head:first-child{margin-top:0}
 .bag-browser .recipe-list,.bag-browser .catalog-grid{max-height:calc(100cqh - 147px)}
 .bag-browser .catalog-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
 .bag-browser .machine .stone{margin-top:3px}
 .bag .slot canvas{width:26px;height:26px;max-width:78%}
}
body{-webkit-touch-callout:none}#hud,.home,.help-list,button{user-select:none;-webkit-user-select:none}
#injury{position:absolute;inset:0;background:radial-gradient(ellipse at center,transparent 48%,#87251c 100%);opacity:0;pointer-events:none}
.touch-help{display:none}
[data-touch-ui=true] .touch-help{display:block}[data-touch-ui=true] .keyboard-help{display:none}
[data-touch-ui=true] #touchHud{display:block}
[data-touch-ui=true] .hud-top .hud-button{min-width:44px;height:44px}
[data-touch-ui=true] input:is([type=text],[type=search]),[data-touch-ui=true] select{font-size:16px}
#moveStick,.acts{position:absolute;bottom:calc(var(--safe-bottom) + var(--slot) + 46px);touch-action:none}
#moveStick{left:max(12px,var(--safe-left));width:clamp(94px,19vmin,118px);aspect-ratio:1;border:2px solid #e5ead384;border-radius:50%;background:#26312388;box-shadow:inset 0 0 0 2px #25332266;pointer-events:auto;display:grid;place-items:center}
#moveStick:before,#moveStick:after{content:"";position:absolute;background:#dce2c34a;pointer-events:none}#moveStick:before{height:2px;width:82%}#moveStick:after{width:2px;height:82%}
#moveStick i{width:42%;aspect-ratio:1;border-radius:50%;border:2px solid #e4ead299;box-shadow:0 2px 2px #17231566;z-index:1;background:#76816bbf}
.acts{right:max(8px,var(--safe-right));display:grid;grid-template-columns:repeat(2,46px);gap:4px}
#touchHud button{min-height:44px;touch-action:none;font-size:13px;padding:2px}#touchHud [aria-pressed=true]{background:#5b7443}
[data-touch-ui=true] .centered{padding:max(8px,var(--safe-top)) max(10px,var(--safe-right)) max(8px,var(--safe-bottom)) max(10px,var(--safe-left))}
@container game (max-width:650px) and (orientation:portrait){#guide{top:calc(max(10px,var(--safe-top)) + 50px);right:auto;left:max(10px,var(--safe-left));max-width:min(260px,83cqw)}}
@container game (orientation:landscape) and (max-height:570px){
 #hud{--slot:clamp(29px,5.1cqw,45px)}
 #moveStick,.acts{bottom:var(--safe-bottom)}
 #guide{max-width:min(240px,40cqw)}
}
@container game (max-width:679px) and (orientation:landscape){.bag-browser .recipe-list,.bag-browser .catalog-grid{max-height:35cqh}}
[data-touch-ui=true] .window{max-height:100%}
[data-touch-ui=true] .world-card,[data-touch-ui=true] .stone.small,[data-touch-ui=true] .preset{min-height:44px}
body:not([data-screen=play]) #toast{bottom:max(12px,var(--safe-bottom))}
@media(prefers-reduced-motion:reduce){#injury{background:none;border:3px solid #a44837}}

#loading{position:fixed;inset:0;z-index:6;background:#152018e8;display:flex;align-items:center;justify-content:center;gap:10px;font-weight:700}
#loading:before{content:"";width:14px;height:14px;background:#b3cc82;box-shadow:inset -3px -3px #69894a;animation:load-turn 1.2s steps(4,end) infinite}
@keyframes load-turn{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){#loading:before{animation:none}}

.touch-setting,#beltBag{display:none}
[data-touch-ui=true] .touch-setting{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:10px 0}
.touch-setting select{background:#273124;color:#edf1de;border:1px solid #849478;padding:6px}
[data-touch-ui=true] #beltBag{display:grid;place-items:center;position:absolute;left:calc(100% + 2px);height:100%;width:var(--slot);padding:0}
[data-touch-ui=true] #hudBag{display:none}
[data-touch-ui=true] #hotbar .slot{touch-action:none}
#hotbar .slot.holding:after{content:"";position:absolute;bottom:3px;left:6%;width:88%;height:3px;background:#dbdfa0;transform-origin:left;animation:drop-hold 1s linear both}
@keyframes drop-hold{from{transform:scaleX(0)}to{transform:scaleX(1)}}
[data-scheme=tap][data-touch-ui=true] #touchHud :is([data-touch=break],[data-touch=use]){display:none}
[data-touch-ui=true] .acts{bottom:calc(var(--safe-bottom) + 6px)}
@container game (max-width:590px){[data-touch-ui=true] .acts{grid-template-columns:44px 44px;gap:2px}[data-touch-ui=true] #hud{--slot:clamp(23px,4.9cqw,32px)}}

#touchHud .acts button{display:grid;place-content:center;justify-items:center;gap:2px;font-size:11px;line-height:1.1}
#touchHud .acts .pixel-icon{width:16px;height:16px;color:#edf1dd;filter:drop-shadow(1px 1px #1d251a)}
@media(pointer:coarse) and (orientation:portrait){
 body:not([data-rotated]) #gameFrame{width:100dvh;height:100vw;transform-origin:0 0;transform:translateX(100vw) rotate(90deg)}
}

#attackRecovery{position:absolute;left:50%;top:calc(50% + 12px);transform:translateX(-50%);width:16px;height:3px;background:#202623bd;pointer-events:none}#attackRecovery i{display:block;height:100%;background:#e0e4d8;transform-origin:left}




#touchFocus{pointer-events:none;position:absolute;width:46px;height:46px;transform:translate(-50%,-50%);border-radius:50%;border:2px solid #ffffffe0;background:#ffffff2b;box-shadow:0 0 0 1px #25342c73;display:grid;place-items:center}
#touchFocus i{width:100%;height:100%;border-radius:50%;background:conic-gradient(#fff 0deg var(--sweep),transparent var(--sweep) 360deg);mask:radial-gradient(transparent 54%,#000 58%);-webkit-mask:radial-gradient(transparent 54%,#000 58%)}
#touchFocus[hidden]{display:none}

/* Experiment chooser */
.home-content{width:min(440px,84cqw);padding:20px 0 44px}
.home .home-actions{display:grid;grid-template-columns:1fr 1fr}
.home .home-actions>.mode-entry{grid-column:auto;min-height:40px;padding:7px;justify-content:center}
.home .mode-entry strong{font-size:15px}.home .mode-entry small{display:none}
.bag #wallet{margin-right:auto}
.cue-pixel{image-rendering:pixelated}

/* The recipe, its source slots and its destination share a single viewport. */
.window.bag{width:min(925px,100%)}
.bag-panes{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.23fr);gap:clamp(10px,2cqw,24px)}
.bag-storage,.bag-browser{min-width:0}
.bag-browser .recipe-list{max-height:min(38cqh,314px);overscroll-behavior:contain;scrollbar-width:thin;align-content:start;padding:1px 3px 2px 1px}
.bag-browser:has(.craft-stage) .recipe-list{max-height:min(29cqh,240px)}
#bagExtra .recipe{display:grid;grid-template-columns:minmax(0,1fr) auto min(44%,106px);align-items:center;gap:4px;min-height:43px;padding:3px 9px;background:#454e40;border:1px solid #636f59;box-shadow:inset 1px 1px #748066}
#bagExtra .recipe.suggested{border-color:#adc38b;background:#53674a;box-shadow:inset 3px 0 #b2c98e}
#bagExtra .recipe:enabled:hover{background:#657855}
#bagExtra .recipe[aria-disabled=true]{opacity:.76}
.recipe-ingredients{display:flex;flex-wrap:wrap;align-items:center;gap:3px 6px;min-width:0}
.recipe-item{display:inline-flex;align-items:center;gap:4px;min-width:0;max-width:100%}
.recipe-name{min-width:0;font:400 16px/1.125 var(--hud-font);overflow-wrap:anywhere}
.recipe-chip{position:relative;display:inline-grid;place-items:center;width:36px;height:34px;flex-shrink:0;background:#2833276b}
.recipe .recipe-chip canvas{width:29px;height:29px}
.recipe-chip b,.craft-sprite b,.craft-prior b{position:absolute;right:2px;bottom:0;color:#fff7dc;font:400 16px/1 var(--hud-font);text-shadow:1px 1px #1d2618,-1px -1px #263427}
.recipe-chip.missing{opacity:.40}.ingredient-plus,.recipe-arrow{color:#c9d3b5;font:600 17px/1 monospace}
.recipe-arrow{padding:0 4px}.recipe-out .recipe-chip{background:#273c29;box-shadow:inset 1px 1px #1f2c20,inset -1px -1px #8c9a73}
.craft-stage{position:relative;border:3px solid #3c3328;box-shadow:inset 0 2px #c39c68,inset 0 -3px #795332;margin:0 2px 8px;height:60px;overflow:hidden;
 background:repeating-linear-gradient(0deg,#9e764d 0 3px,#b48859 3px 14px,#785535 14px 16px,#ab8052 16px 27px)}
.stage-notch{position:absolute;top:50%;left:50%;height:4px;width:4px;background:#e4c99a}
.stage-notch.left,.stage-notch.right{width:12px;height:16px;transform:translate(-32px,-50%);background:none;border:2px solid #dac095;border-right:0}
.stage-notch.right{transform:translate(20px,-50%) rotate(180deg)}
#craftFX{position:absolute;inset:0;z-index:30;pointer-events:none;overflow:hidden}
.craft-sprite{position:absolute;top:0;left:0;display:grid;place-items:center;will-change:transform;filter:drop-shadow(1px 2px 0 #27302388)}
.craft-sprite canvas,.craft-prior canvas{width:100%;height:100%;image-rendering:pixelated}
.craft-spark{background:#ffe496}.craft-sprite b{font-size:14px}
.slot.awaiting-craft>canvas,.slot.awaiting-craft>.count,.slot.awaiting-craft>.wear{visibility:hidden}
.craft-prior{position:absolute;inset:12%;display:block}

/* One contextual gesture near its subject. */
#hud #guide{--size:26px;position:absolute;left:50%;top:auto;right:auto;bottom:calc(var(--safe-bottom) + var(--slot) + 40px);transform:translateX(-50%);
 display:flex;align-items:center;justify-content:center;gap:5px;padding:5px 7px;max-width:none;pointer-events:none;background:#253027dc;
 border:1px solid #adbd9680;box-shadow:1px 2px 0 #17201688;z-index:2}
#guide .cue-pixel{width:var(--size);height:var(--size)}
#guide .cue-arrow{width:13px;height:9px;background:#dfdca9;clip-path:polygon(0 33%,60% 33%,60% 0,100% 50%,60% 100%,60% 67%,0 67%)}
#guide kbd{font:400 16px/1 var(--hud-font);border:1px solid #bbc9a5;padding:3px}
#hud #guide[data-anchor=tree],#hud #guide[data-anchor=sky],#hud #guide[data-anchor=danger]{top:25%;bottom:auto}
#hud #guide[data-anchor=danger]{border-color:#df947a}
#guide:is([data-anchor=danger],[data-anchor=direction]):before{content:'';height:12px;width:10px;background:#ee9a76;clip-path:polygon(50% 0,100% 100%,50% 78%,0 100%);transform:rotate(var(--bearing,0rad))}
#hud #guide[data-anchor=food]{left:calc(50% + min(105px,13cqw))}
#hud #guide[data-anchor=health]{left:calc(50% - min(105px,13cqw))}
#hud #guide.at-object{top:clamp(10%,var(--cue-y),80%);bottom:auto;left:clamp(12%,var(--cue-x),88%);transform:translate(-50%,calc(-100% - 17px))}
#guide.at-object:after{content:'';position:absolute;top:100%;left:calc(50% - 4px);width:8px;height:8px;background:#d8dcaf;clip-path:polygon(0 0,100% 0,50% 100%)}
@media(prefers-reduced-motion:no-preference){
 #guide .cue-pixel:first-child{animation:cue-gesture 1.3s ease-in-out infinite}
 #guide[data-anchor=health] .cue-pixel:last-child{animation:cue-beat 1.3s ease-in-out infinite}
 .cue-highlight,.slot.guide-item{animation:cue-shine 1.4s ease-in-out infinite}
 @keyframes cue-gesture{0%,100%{transform:translateX(-2px)}45%{transform:translateX(3px) rotate(-5deg)}}
 @keyframes cue-beat{50%{transform:scale(1.12)}}
 @keyframes cue-shine{50%{filter:brightness(1.4);outline:2px solid #dfcc8a}}
}
@media(prefers-reduced-motion:reduce){.cue-highlight,.slot.guide-item{outline:1px solid #eed894}}
@container game (max-height:520px){
 .home-content{width:min(590px,85cqw);padding:8px 0 28px}.home h1{width:min(260px,52cqw);margin-bottom:3px}
 .bag .recipe{min-height:33px}.bag-browser .recipe-list{max-height:calc(100cqh - 131px)}.bag-browser:has(.craft-stage) .recipe-list{max-height:calc(100cqh - 180px)}
 .craft-stage{height:44px}.recipe-chip{height:28px;width:29px}.recipe .recipe-chip canvas{width:24px;height:24px}#hud #guide{--size:20px}
}
@container game (max-width:610px){.bag-panes{grid-template-columns:minmax(0,.95fr) minmax(0,1.1fr);gap:5px}#bagExtra .recipe{gap:1px;padding-inline:2px}.recipe-arrow{padding:0}.bag .head{flex-wrap:wrap}.bag .bag-ops .stone{padding-inline:5px}}
@media(prefers-reduced-motion:no-preference){
 #guide[data-hold=true] .cue-pixel:first-child{animation:hold-input 1.65s ease-in-out infinite}
 @keyframes hold-input{0%,80%,100%{transform:scale(1);filter:none}20%,60%{transform:scale(.88);filter:drop-shadow(0 0 2px #aee2e1)}}
}
.station-grid{--cells:2;display:inline-grid;grid-template-columns:repeat(var(--cells),1fr);width:18px;height:18px;gap:1px;vertical-align:middle}
.station-grid i{background:#d2d6ba;box-shadow:inset -1px -1px #8f9d82}
.station-gesture{display:inline-flex;align-items:center;gap:8px;margin-left:3px;pointer-events:none}
.station-gesture>.cue-pixel{width:16px;height:16px}
.bench-tile{position:relative;display:inline-block;width:28px;height:32px}
.bench-tile canvas{position:absolute;width:23px;height:23px;bottom:0;left:2px}
.bench-tile canvas+canvas{bottom:10px}
@media(prefers-reduced-motion:no-preference){
 .bench-tile canvas+canvas{animation:bench-drop 1.9s ease-out 2}
 .station-gesture>.station-grid{animation:grid-show 1.9s ease-out 2}
 @keyframes bench-drop{0%{opacity:0;transform:translate(-5px,-12px)}35%,100%{opacity:1;transform:translate(0,0)}}
 @keyframes grid-show{0%,40%{opacity:.25}65%{opacity:1;transform:scale(1.1)}100%{transform:scale(1)}}
}

#hud #guide {width:max-content;max-width:min(86cqw,440px);gap:7px;font:400 16px/1.25 var(--hud-font)}
#guide .cue-pixel {flex:none;image-rendering:pixelated}
#guide .cue-label {min-width:0;overflow-wrap:anywhere}
#guide kbd {white-space:normal;flex:0 0 auto;max-width:40%;color:#253227;background:#e3ead8;text-shadow:none;text-align:center}
#hud #guide.at-object {left:clamp(min(44cqw,224px),var(--cue-x),max(56cqw,calc(100% - 224px)))}
.recipe-cue,.panel-cue {font:400 16px/1.25 var(--hud-font);color:#eef6d9;background:#273c29;padding:4px 7px;text-align:left}
.recipe-cue {grid-column:1/-1}
.panel-cue {margin:0 0 5px}
@container game (max-width:600px){
 #hud #guide[data-anchor=food],#hud #guide[data-anchor=health]{left:50%}
}

/* Keep the world in view as the camera pulls away. The title stays in the
   same place when the actions appear, including on short landscape screens. */
#lifeVeil{position:absolute;inset:0;z-index:1;pointer-events:none;display:none}
body[data-moment] #lifeVeil{display:block;opacity:var(--veil,0)}
body[data-moment=death] #lifeVeil{background:radial-gradient(ellipse at 50% 43%,#27171d59 10%,#2b101dcc 65%,#100910 100%),linear-gradient(0deg,#210f21a6,#3d14232b)}
body[data-moment=death] #world{filter:saturate(var(--chroma,1))}
body[data-moment=respawn] #lifeVeil{background:#17202c}
body[data-moment=sleep] #lifeVeil,body[data-moment=wake] #lifeVeil{background:#0a0c18}
body:is([data-moment=sleep],[data-moment=wake]) #momentScreen::before{content:'';pointer-events:none;position:absolute;inset:0;opacity:var(--veil,0);background:linear-gradient(180deg,#080b15 0%,transparent 38%,transparent 70%,#090c16 100%);background-size:100% 100%;box-shadow:inset 0 0 12cqh #090d1750}
body[data-moment] #toast{visibility:hidden}
#deadScreen{display:grid;grid-template-rows:45% 1fr;justify-items:center;text-align:center;overflow:hidden;background:transparent}
#deathTitle{align-self:end;margin:0;font:normal clamp(32px,8cqh,66px)/1.05 var(--hud-font);letter-spacing:.12em;text-indent:.12em;color:#f5dfda;text-shadow:0 3px #512831,0 4px 18px #170e12;opacity:var(--death-title,1);outline:none}
#deathActions{align-self:start;margin-top:clamp(10px,3.5cqh,28px);display:grid;gap:6px;width:min(242px,62cqw);animation:death-actions .26s ease-out both}
#deathHint:not(:empty){margin:0 0 8px;color:#e2d2c8;font:16px/1.2 var(--hud-font);text-shadow:0 1px 4px #160d12}
#deathHint:empty{display:none}
#leaveBed,#bedKey{position:absolute;bottom:max(8cqh,var(--safe-bottom));left:50%;transform:translateX(-50%);font-family:var(--hud-font)}
#bedKey{display:none;background:#161d27b3;padding:5px 9px;color:#e0ddcf;font-size:14px}
body[data-moment=sleep][data-locked=true] #bedKey{display:block}
body[data-locked=true] #leaveBed{display:none}
@keyframes death-actions{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){#deathActions{animation:none}}

.armor-rack{display:flex;align-items:center;gap:.25rem;flex-wrap:wrap;margin-top:.4rem}
.armor-rack[hidden]{display:none}
.armor-caption,.armor-piece{font:inherit;font-size:.83rem}
.armor-caption{margin-right:.35rem}
.armor-piece{display:inline-flex;align-items:center;gap:.2rem;padding:.17rem .35rem;border:1px solid #9b9d80;background:#454c3e;color:#fbf5da;cursor:pointer}
.armor-piece:disabled{color:#b9bca8;background:#41473a;cursor:default}
.armor-piece canvas{width:1.4rem;height:1.4rem;image-rendering:pixelated}

#paperReadout{position:absolute;bottom:clamp(75px,16cqh,120px);right:clamp(12px,5cqw,100px);width:clamp(46px,10cqh,88px);height:auto;image-rendering:pixelated;pointer-events:none}
#paperReadout.map-readout{width:clamp(76px,20cqh,154px);border:3px solid #795e39}
[data-touch-ui=true] #paperReadout{right:22cqw}
.paper-window{max-width:440px}
#paperBody{display:grid;gap:10px;justify-items:center}
.paper-window:has(.trade-list){display:flex;flex-direction:column;overflow:hidden}
.paper-window:has(.trade-list) .head{flex:none}
#paperBody:has(.trade-list){display:flex;flex-direction:column;min-height:0;gap:6px}
.trade-balance,.trade-price,.trade-item{display:flex;align-items:center;gap:8px}
.trade-balance{font-size:14px;color:#eee8ce}
.trade-balance canvas,.trade-price canvas{width:22px;height:22px;image-rendering:pixelated}
.trade-list{display:grid;grid-template-columns:minmax(0,1fr);gap:4px;overflow-y:auto;overscroll-behavior:contain;padding:4px;min-height:0}
.trade-list h3{font-size:13px;color:#d3d8bc;margin:4px 0 1px}
.trade-list h3:not(:first-child){margin-top:10px}
.trade-offer{display:grid;grid-template-columns:62px 18px minmax(0,1fr);align-items:center;gap:6px;min-height:44px;text-align:left}
.trade-price{justify-content:center;font-variant-numeric:tabular-nums}
.trade-item canvas{flex:none;width:28px;height:28px;image-rendering:pixelated}
.paper-instrument{width:min(46cqh,83%);aspect-ratio:1;image-rendering:pixelated}
.paper-leaf,.paper-sign{width:100%;color:#352b1d;box-sizing:border-box}
.paper-leaf{min-height:135px;max-height:40cqh;overflow:auto;resize:vertical;white-space:pre-wrap;overflow-wrap:anywhere;background:#e3d1a8;border:2px solid #806947;padding:12px;font:inherit;line-height:1.6;user-select:text}
.paper-sign{display:grid;gap:2px;text-align:center;background:#b88855;border:3px solid #805c3b;padding:8px;box-shadow:inset 0 -2px #986e47}
.paper-sign p,.paper-sign input{margin:0;min-height:1.4em;text-align:center;background:transparent;color:#372819;font:inherit;border:0;padding:0;box-shadow:none}
.paper-sign input{border-bottom:1px solid #93704c;width:100%}
.paper-nav,.paper-signature{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%}
.paper-signature input{flex:1}
.slot.enchanted canvas{filter:drop-shadow(1px -1px 1px #b088ed) drop-shadow(-1px 1px 1px #615691)}
.ornament-bench{display:grid;gap:.65rem;padding:.5rem;overflow:auto}.ornament-bench label{display:flex;align-items:center;gap:.55rem}.ornament-bench select{min-height:2rem;max-width:100%}.ornament-choices{display:flex;align-items:center;gap:.45rem .8rem;flex-wrap:wrap}.ornament-preview{min-height:3.5rem;display:flex;align-items:center;gap:.65rem}.ornament-preview canvas{width:3.5rem;height:3.5rem;image-rendering:pixelated}.ornament-bench p{margin:0}.ornament-bench .stone{justify-self:start}

#attackRecovery[data-ready=true] i{background:#d4ed94;box-shadow:0 0 0 1px #536743}
[data-touch-ui=true][data-scheme=tap] #attackRecovery{top:auto;bottom:calc(var(--safe-bottom) + var(--slot) + 10px);width:25px}

#itemInsight{position:absolute;z-index:70;pointer-events:none;max-width:min(270px,74cqw);width:max-content;padding:8px 10px;background:#243026;color:#f1f3df;border:1px solid #b3c49c;box-shadow:2px 2px 0 #152016aa;font:400 16px/1.3 var(--hud-font)}
#itemInsight strong,#itemInsight span{display:block}
#itemInsight strong{color:#e5d99c;margin-bottom:2px}
#guide .cue-yield{display:inline-flex;align-items:center;gap:3px;white-space:nowrap;color:#e6efd1}
#benchOpportunity{display:flex;align-items:center;gap:6px;font:400 16px/1.2 var(--hud-font);color:#eaf0d8;margin:0 0 5px;padding:4px 6px;background:#364631}
#benchOpportunity canvas{width:24px;height:24px;image-rendering:pixelated}

.shelter-steps{width:36px;height:24px;position:relative;flex:none}.shelter-steps canvas{position:absolute;inset:0;width:100%;height:100%;image-rendering:pixelated}
@media(prefers-reduced-motion:no-preference){.shelter-steps canvas{animation:shelter-frame 3s step-end infinite;opacity:0}.shelter-steps canvas:nth-child(2){animation-delay:1s}.shelter-steps canvas:nth-child(3){animation-delay:2s}}
@keyframes shelter-frame{0%{opacity:1}33.333%,100%{opacity:0}}

#touchInspectHint{display:none}
[data-touch-ui=true] #inventoryScreen:not([data-inspected=true]) #touchInspectHint{display:inline;color:#e1e8d0;font:400 14px/1.1 var(--hud-font)}
