@font-face{
 font-family:"DEEPFALL Dot";
 src:url("fonts/DotGothic16-Regular.woff2") format("woff2");
 font-weight:400;
 font-display:swap;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#050608;color:#e6e2d8;font-family:"Nosutaru-dotMPlusH-10-Regular","Nosutaru Dot (M+)","ノスタルドット（M+）","DEEPFALL Dot",monospace;display:flex;align-items:center;justify-content:center;overscroll-behavior:none;ime-mode:disabled}
button,input,select{font-family:inherit}
#stage{position:relative;width:100vw;height:56.25vw;max-height:100vh;max-width:177.78vh;background:#090b10;overflow:hidden;border:2px solid #1e222d;box-shadow:0 0 0 2px #000}
#c{position:absolute;inset:0;width:100%;height:100%;display:block;cursor:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%222%22%20fill%3D%22white%22%20opacity%3D%22.75%22%2F%3E%3C%2Fsvg%3E") 8 8,default;image-rendering:pixelated;image-rendering:crisp-edges;ime-mode:disabled}

.pxbox{background:#1d2029;border:2px solid #090a0f;box-shadow:inset 2px 2px 0 #484f63,inset -2px -2px 0 #101218,0 4px 0 #050608;color:#e6e2d8}
.pxbtn{display:block;width:100%;margin:6px 0;padding:10px 12px;background:#2b303e;border:2px solid #090a0f;box-shadow:inset 2px 2px 0 #5b637a,inset -2px -2px 0 #181b24;color:#f0ece1;font-family:inherit;font-size:14px;font-weight:700;cursor:pointer;text-align:center;letter-spacing:.5px}
.pxbtn:hover:not(:disabled){background:#373e50}
.pxbtn:active:not(:disabled){transform:translateY(2px);box-shadow:inset 2px 2px 0 #181b24,inset -2px -2px 0 #5b637a}
.pxbtn.red{background:#592222;box-shadow:inset 2px 2px 0 #944343,inset -2px -2px 0 #331010}
.pxbtn.red:hover:not(:disabled){background:#6b2929}
.pxbtn.dim{background:#20232d;box-shadow:inset 2px 2px 0 #3d4354,inset -2px -2px 0 #12141b;font-weight:400;font-size:13px;padding:8px}
.pxbtn:disabled{opacity:.4;cursor:not-allowed}

#topbtns{position:absolute;top:8px;left:8px;display:flex;gap:6px;z-index:7}
.tb{width:clamp(28px,3.2vw,36px);height:clamp(28px,3.2vw,36px);background:#1d2029;border:2px solid #090a0f;box-shadow:inset 2px 2px 0 #525a70,inset -2px -2px 0 #101218;color:#e6e2d8;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center}
.tb:hover{background:#2d3242}
.tb:active{transform:translateY(1px)}
.tb img{width:70%;height:70%;image-rendering:pixelated}
.tb.pulse{border-color:#ffd54a;box-shadow:inset 2px 2px 0 #ffe080,0 0 8px #ffd54a}

#hotbar{position:absolute;left:8px;top:44px;display:flex;gap:clamp(2px,.4vw,4px);max-width:calc(100% - 220px);overflow-x:auto;padding:clamp(3px,.5vw,5px);background:#14161e;border:2px solid #090a0f;box-shadow:inset 2px 2px 0 #383d4d,inset -2px -2px 0 #0c0d12;z-index:6;scrollbar-width:none}
#hotbar::-webkit-scrollbar{display:none}
.slot{position:relative;flex:0 0 auto;width:clamp(34px,4.5vw,48px);height:clamp(34px,4.5vw,48px);background:#222633;border:2px solid #0b0c12;box-shadow:inset 1px 1px 0 #444a5e,inset -1px -1px 0 #13151d;display:flex;align-items:center;justify-content:center;cursor:pointer}
.slot.sel{background:#473b1d;border-color:#d4a742;box-shadow:inset 1px 1px 0 #ffd970,inset -1px -1px 0 #7a5c18}
.slot img{width:68%;height:68%;image-rendering:pixelated;pointer-events:none}
.slot .k,.slot .num{position:absolute;top:1px;left:2px;font-size:clamp(6px,.7vw,8px);color:#9aa4c0;line-height:1;z-index:2;text-shadow:1px 1px 0 #000}
.slot .n,.slot .cnt{position:absolute;bottom:1px;left:2px;font-size:clamp(8px,.95vw,10px);font-weight:700;color:#fff;text-shadow:1px 1px 0 #000,-1px 0 0 #000;line-height:1;z-index:2}

#toast{position:absolute;top:46px;left:50%;transform:translateX(-50%);background:#141720;border:2px solid #090a0f;box-shadow:inset 1px 1px 0 #6b738f,inset -1px -1px 0 #0d0f16;padding:6px 12px;font-size:12px;z-index:12;opacity:0;transition:opacity .2s;pointer-events:none;max-width:85%;text-align:center;color:#f4e8c1}
#toast.on{opacity:1}
#leftBottomDock{position:absolute;left:8px;bottom:8px;z-index:30;display:flex;flex-direction:column;align-items:flex-start;gap:8px;max-height:calc(100% - 16px);max-width:calc(100% - 16px);pointer-events:none}
#leftBottomDock>*{pointer-events:auto}
#debugPanel{min-height:0;flex-shrink:1;overflow:auto}
#bPlaceMode{flex:none;width:auto;padding:0 8px;font-size:11px}
#bPlaceMode[data-active="false"]{background:none;border-color:transparent;box-shadow:none;color:rgba(230,226,216,.55);text-shadow:1px 1px 1px #000}
#debugTabs{display:flex;flex-wrap:wrap;gap:3px;margin:8px 0}
#debugTabs button{flex:1;background:#202536;color:#dce2ef;border:1px solid #505a70;padding:3px 3px;font-family:inherit;cursor:pointer}
#debugTabs button[aria-selected="true"]{background:#4b4028;color:#ffe098;border-color:#d4a742}
#debugBody input[type="number"]{width:6em}
#debugTeleportGrid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;margin:6px 0}
#debugTeleportGrid button{height:18px;padding:0;background:#293247;color:#e6e2d8;border:1px solid #596780;cursor:pointer;font:inherit}
#leftBottomDock #debugMetrics{flex:none;pointer-events:none;white-space:pre-wrap;line-height:1.55;margin:0;font-size:11px;opacity:.72;color:#e6edf7;text-shadow:1px 1px 1px #000;max-width:100%}
.touchOnly{display:none}
html[data-input="touch"] body{height:100dvh;-webkit-text-size-adjust:100%;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
html[data-input="touch"] #stage{width:100%;height:100%;max-width:none;max-height:none}
html[data-input="touch"] #c{inset:calc(50% - 26px) auto auto 50%;transform:translate(-50%,-50%);width:min(100%,calc((100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9));height:auto;touch-action:none}
/* Portrait phones: zoom the view 2x around the player (the canvas is twice the stage width; #stage crops the sides). */
@media (orientation:portrait){html[data-input="touch"] #c{width:200%;inset:calc(50% - 2px) auto auto 50%}}
html[data-input="touch"] #hotbar{max-width:calc(100% - 16px);touch-action:pan-x}
html[data-input="touch"] #topbtns .tb{width:44px;height:44px}
html[data-input="touch"] #hotbar{top:56px}
html[data-input="touch"] #leftBottomDock{bottom:58px;max-height:calc(100% - 75px)}
html[data-input="touch"] #pause.on{z-index:31}
html[data-input="touch"] .touchOnly.pxbtn,html[data-input="touch"] .touchOnly.how{display:block}
html[data-input="touch"] #touchControls{position:absolute;inset:auto 6px 6px;z-index:10;display:flex;justify-content:space-between;gap:4px;pointer-events:none}
html[data-input="touch"] #touchControls>div{display:flex;align-content:flex-end;flex-wrap:wrap;gap:4px}
html[data-input="touch"] #touchControls>div:first-child{flex-shrink:0}
html[data-input="touch"] #touchControls>div:last-child{justify-content:flex-end}
html[data-input="touch"] #touchControls button{width:44px;height:44px;pointer-events:auto;touch-action:none;font:inherit;font-size:11px;font-weight:700}
html[data-input="touch"] #touchControls button[aria-pressed="true"],html[data-input="touch"] #touchControls button[data-held]{background:#473b1d;border-color:#e0b650}
html[data-input="touch"] #title.on~#touchControls,html[data-input="touch"] #pause.on~#touchControls,html[data-input="touch"] #dead.on~#touchControls,html[data-input="touch"] #invModal.on~#touchControls,html[data-input="touch"] #craft.on~#touchControls{display:none}
html[data-input="touch"] .keyboardOnly{display:none}

.worldRow{display:flex;align-items:center;gap:6px}
.worldRow .tb{flex:none}


.ov{position:absolute;inset:0;z-index:20;display:none;align-items:center;justify-content:center;background:rgba(4,5,8,.82);padding:12px}
.ov.on{display:flex}
#genScreen{background:#050608}
.genBox{max-width:520px;text-align:center}
.genLabel{min-height:2.6em;margin:10px 0 12px;font-size:14px;color:#f0ece1;line-height:1.7}
.genTrack{height:22px;padding:2px;box-sizing:border-box;background:#0d0f16;border:2px solid #090a0f;box-shadow:inset 2px 2px 0 #101218,inset -1px -1px 0 #3a4054}
.genFill{height:100%;width:0;background:repeating-linear-gradient(90deg,#5fd37f 0 10px,#3aa463 10px 12px);transition:width .25s linear}
.genPct{margin-top:8px;font-size:12px;color:#9aa3bd}
.ov.nonblock{background:rgba(4,5,8,.38);pointer-events:none}
.ov.nonblock .box{pointer-events:auto}
.box{max-width:580px;width:100%;max-height:86%;overflow-y:auto;padding:16px}
h1{margin:0 0 4px;font-size:clamp(20px,3vw,28px);letter-spacing:3px;text-align:center;color:#e8c468;text-shadow:3px 3px 0 #000}
.sub{text-align:center;color:#9aa3bd;margin:0 0 12px;font-size:12px}
h4{margin:12px 0 6px;font-size:12px;color:#d4a742;border-bottom:2px solid #101218;padding-bottom:3px;text-transform:uppercase}
.how{font-size:11.5px;line-height:1.65;color:#c8cddb;background:#14161e;border:2px solid #0c0d12;padding:8px 10px}
.rec{display:flex;align-items:center;gap:8px;padding:6px;background:#161822;border:2px solid #0c0d12;margin:4px 0;opacity:.5}
.rec.ok{opacity:1;background:#202536;box-shadow:inset 1px 1px 0 #485270}
.rec.pin{border-color:#d4a742}
.ri{width:30px;height:30px;display:flex;align-items:center;justify-content:center}
.ri img{width:26px;height:26px;image-rendering:pixelated}
.rn{flex:1;font-size:12.5px}
.rn small{display:block;font-size:10.5px;color:#939cb5}
.rec button{padding:5px 9px;background:#2f3954;border:2px solid #090a0f;box-shadow:inset 1px 1px 0 #66759c;color:#fff;cursor:pointer;font-family:inherit;font-size:11.5px;font-weight:700}
.rec button.pinbtn{background:#242836;font-weight:400}
.rec button:disabled{opacity:.3;cursor:not-allowed}
.chips{display:flex;flex-wrap:wrap;gap:4px;margin:4px 0}
.chip{display:flex;align-items:center;gap:4px;background:#14161e;border:1px solid #2e3447;padding:3px 6px;font-size:11px}
.chip img{width:16px;height:16px;image-rendering:pixelated}
.x{float:right;width:28px;height:28px;background:#402222;border:2px solid #090a0f;box-shadow:inset 1px 1px 0 #7a4242;color:#fff;cursor:pointer;font-family:inherit;font-weight:700}

.tgrid{display:grid;grid-template-columns:repeat(10,minmax(28px,1fr));gap:4px;margin:8px 0}
.tslot{position:relative;aspect-ratio:1;background:#1c202c;border:2px solid #090a0f;box-shadow:inset 1px 1px 0 #3f465e;display:flex;align-items:center;justify-content:center;cursor:pointer;user-select:none}
.tslot.hb{border-color:#5a6588;background:#232838}
.tslot.sel{border-color:#ffd54a;box-shadow:inset 1px 1px 0 #fff2a8}
.tslot.trash{border-color:#7a2e2e;background:#2b161a}
.tslot img{width:22px;height:22px;image-rendering:pixelated;pointer-events:none}
.tslot .cnt{position:absolute;right:2px;bottom:1px;font-size:10px;font-weight:700;color:#fff;text-shadow:1px 1px 0 #000}
.tslot .hk{position:absolute;left:2px;top:1px;font-size:8px;color:#9aa4c0}
#itemTip{position:fixed;z-index:110;pointer-events:none;background:#10131c;color:#f0ece1;border:1px solid #687087;padding:5px 8px;font-size:12px;max-width:90vw}
#curItem{position:fixed;pointer-events:none;z-index:99;display:none;transform:translate(-50%,-50%)}
#curItem img{width:24px;height:24px;image-rendering:pixelated}
#curItem span{position:absolute;right:-4px;bottom:-2px;font-size:11px;font-weight:700;color:#fff;text-shadow:1px 1px 0 #000}

.keyHeader{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.keyHeader .x{float:none;flex:none}
.kbrow{display:grid;grid-template-columns:minmax(0,1.4fr) repeat(3,minmax(0,1fr));gap:6px;align-items:center;padding:6px 8px;background:#14161e;border:1px solid #282d3d;margin:4px 0;font-size:12.5px}
.kbrow button{min-width:0;padding:5px 3px;background:#2b303e;border:2px solid #090a0f;box-shadow:inset 1px 1px 0 #5b637a;color:#ffd54a;font-family:inherit;font-size:12px;font-weight:700;cursor:pointer;overflow-wrap:anywhere}
.kbrow button.wait{background:#592222;color:#fff;border-color:#ffd54a}
