*{box-sizing:border-box}body{margin:0;color:#253331;background:#f5f8f6;font-family:"Hiragino Kaku Gothic ProN","Yu Gothic","Meiryo",system-ui,sans-serif;font-size:16px;line-height:1.65}.world-page{max-width:1180px;margin:auto;padding:20px;color:#273d43}.breadcrumb{font-size:.85rem}.world-hero{padding:20px 0}.world-hero h1{font-size:clamp(1.5rem,4vw,2.2rem);margin:.4em 0}.game-shell{border:1px solid #ccdcd6;border-radius:16px;overflow:hidden;background:#d8ece8;box-shadow:0 8px 28px #29493912}#game-frame{position:relative;height:min(760px,90svh);min-height:530px;overflow:hidden;background:#bad2d5;color:#18332e}#scene{display:block;width:100%;height:100%;touch-action:none;outline-offset:-4px}#game-frame button{font:inherit;min-width:44px;min-height:44px;border:1px solid #a6bdb4;border-radius:9px;padding:9px 14px;background:#fffef5;color:#213f38;cursor:pointer;line-height:1.3;touch-action:none;user-select:none}#game-frame button:focus-visible{outline:3px solid #eeaf3c;outline-offset:2px}#game-frame .primary{background:#2d6654;color:white;border-color:#2d6654}.topbar{position:absolute;right:12px;top:12px;display:flex;gap:6px}.lookbar{position:absolute;left:12px;top:68px;display:flex;gap:6px}.touch-controls{position:absolute;bottom:28px;left:12px;right:12px;display:flex;justify-content:space-between;align-items:end;pointer-events:none}.touch-controls button{pointer-events:auto}.dpad{display:grid;grid-template-columns:48px 48px 48px;grid-template-rows:44px 44px 44px;gap:3px;text-align:center;align-items:center}.dpad button{padding:0!important;height:44px}.dpad button:first-child,.dpad button:last-child{grid-column:2}.dpad span{font-size:.75rem;background:#fffef5d9;border-radius:5px}.action-pad{display:flex;flex-direction:column;gap:8px;align-items:end}.overlay{position:absolute;inset:0;background:#153c3c55;display:flex;justify-content:center;align-items:center;padding:12px;z-index:5}.dialog{background:#fffdf3;border:1px solid #d1d9c7;border-radius:14px;width:min(510px,100%);max-height:100%;overflow:auto;padding:20px;box-shadow:0 10px 40px #1235}.dialog h2{font-size:1.3rem;margin:0 0 12px}.actions{display:flex;gap:8px;flex-wrap:wrap}.status{position:absolute;bottom:4px;left:12px;font-size:.75rem;background:#fffef0dd;border-radius:4px;padding:0 6px;pointer-events:none}.guide{padding:20px 0}.guide h2{font-size:1.2rem}.stage-note{font-size:.9rem;color:#53665f}#game-frame.expanded{position:fixed;inset:0;z-index:10000;height:100svh;min-height:0}body.world-expanded{overflow:hidden}[hidden]{display:none!important}@media(max-width:600px){.world-page{padding:12px}.world-hero{padding:12px 0}.world-hero p{font-size:.9rem}#game-frame{height:84svh;min-height:540px}.topbar{top:8px;right:8px;gap:4px}#game-frame button{padding:8px 10px;font-size:.88rem}.lookbar{left:8px;top:64px}.touch-controls{left:8px;right:8px}.dialog{padding:16px}.dialog h2{font-size:1.15rem}}
/* Keep the directional controls in a cross, independent of auto-placement. */
.dpad [data-hold="up"]{grid-row:1;grid-column:2}.dpad [data-hold="left"]{grid-row:2;grid-column:1}.dpad span{grid-row:2;grid-column:2}.dpad [data-hold="right"]{grid-row:2;grid-column:3}.dpad [data-hold="down"]{grid-row:3;grid-column:2}
.fishing-record{position:absolute;left:12px;top:122px;max-width:230px;padding:2px 6px;border-radius:4px;background:#183b34d9;color:#fffdf0;font-size:12px;pointer-events:none}
.topbar{flex-wrap:wrap;justify-content:flex-end;max-width:calc(100% - 16px)}
.lookbar{max-width:calc(100% - 16px);flex-wrap:wrap}#lantern[aria-pressed="true"]{background:#fff0b8;border-color:#bd8d32}


/* Shared-world controls and functional participant/location labels. */
.shared-world{padding:14px 0}.shared-world p{margin:6px 0}.shared-world button,#player-name{font:inherit;min-height:44px;border:1px solid #a6bdb4;border-radius:8px;padding:8px 12px;background:#fffef5;color:#213f38}#player-name{display:block;width:100%;margin:6px 0}#join-fields p{font-size:.88rem}.world-label{position:absolute;transform:translate(-50%,-100%);padding:2px 6px;border-radius:4px;background:#173e3be6;color:white;font-size:12px;pointer-events:none;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.meeting-label{background:#735d1bea}#peer-status{color:#855024}button:disabled{cursor:default;opacity:.65}

/* Functional woodcut target/inventory readout; no new visual assets. */
.woodcut-record{position:absolute;left:12px;top:122px;max-width:calc(100% - 24px);padding:3px 7px;border-radius:4px;background:#fffef0e8;font-size:12px;pointer-events:none}.woodcut-record span{display:block}

#build-status{max-width:310px}.action-pad{max-width:45%}.action-pad button{max-width:100%}@media(max-width:600px){#build-status{max-width:calc(100vw - 55px);font-size:11px}.action-pad{gap:5px}.action-pad button{padding:6px 8px!important}}

/* Farming uses the existing action panel. */
#farm-mode,#farm-action{min-height:44px;max-width:100%;white-space:normal}.farm-status,.farm-inventory{margin:.3rem .8rem;font-size:.85rem;overflow-wrap:anywhere}.action-pad{min-width:0}

#fishing-mode,#fish-action{min-height:44px;max-width:100%;white-space:normal}#fishing-status{overflow-wrap:anywhere}

#cooking-mode,#cook-action,#eat{min-height:44px;max-width:100%;white-space:normal}#cooking-status{overflow-wrap:anywhere}

#storage-mode,#storage-action{min-height:44px;max-width:100%;white-space:normal}.storage-panel{position:absolute;left:12px;bottom:180px;width:min(400px,calc(100% - 24px));max-height:44%;overflow:auto;background:#fffef5f2;color:#213f38;padding:8px;box-sizing:border-box;border:1px solid #a6bdb4;border-radius:8px}.storage-panel[hidden]{display:none}.storage-panel p{margin:0 0 5px;font-size:12px}.storage-panel input{width:70px;min-height:44px;box-sizing:border-box;font:inherit}.storage-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:4px;align-items:center;margin-top:4px}.storage-row span{font-size:12px;overflow-wrap:anywhere}.storage-panel .storage-row button{padding:6px;font-size:12px;min-height:44px;min-width:44px}

/* Only the storage work readout remains while choosing or transporting. */
#game-frame.storage-mode-active .woodcut-record>span{display:none}#game-frame.storage-mode-active .woodcut-record>#storage-status{display:block}#game-frame.storage-mode-active .woodcut-record{top:122px;max-width:calc(100% - 24px)}

#game-frame.storage-mode-active .woodcut-record>#storage-carry-info:not([hidden]){display:block}#game-frame.storage-mode-active .woodcut-record{line-height:1.35}#game-frame.storage-mode-active .storage-panel{max-height:min(44%,calc(100% - 370px))}

#game-frame #furniture-mode{font-size:12px;padding:6px;min-height:44px}#furniture-kind,#furniture-rotate,#furniture-action,#stand{min-height:44px;max-width:100%;white-space:normal}#game-frame.furniture-mode-active .woodcut-record>span{display:none}#game-frame.furniture-mode-active .woodcut-record>#furniture-count,#game-frame.furniture-mode-active .woodcut-record>#furniture-status{display:block}#game-frame.furniture-mode-active .woodcut-record{line-height:1.35;max-width:calc(100% - 24px)}

#game-frame #bed-mode{font-size:12px;padding:6px;min-height:44px}#bed-action,#bed-rotate,#set-resume-bed,#clear-resume-bed{min-height:44px;max-width:100%;white-space:normal}#game-frame .woodcut-record{top:var(--work-hud-top,122px)}#game-frame.bed-mode-active .woodcut-record>span{display:none}#game-frame.bed-mode-active .woodcut-record>#bed-count,#game-frame.bed-mode-active .woodcut-record>#bed-status{display:block}#game-frame.bed-mode-active .woodcut-record{top:var(--work-hud-top,122px);line-height:1.35;max-width:calc(100% - 24px)}

#tree-action,#farm-crop-select,#farm-tree-select{min-height:44px;max-width:100%;white-space:normal}#farm-kind{display:flex;gap:6px;flex-wrap:wrap}#farm-kind[hidden]{display:none}#farm-kind button{font-size:12px;padding:6px 12px}#game-frame:not(.tree-mode) #tree-status{display:none}#game-frame.tree-mode .woodcut-record>span{display:none}#game-frame.tree-mode .woodcut-record>#farm-kind,#game-frame.tree-mode .woodcut-record>#tree-stock,#game-frame.tree-mode .woodcut-record>#tree-status{display:block}#game-frame.tree-mode .woodcut-record>#farm-kind{display:flex}#game-frame.tree-mode .woodcut-record{max-width:calc(100% - 166px);line-height:1.3}#game-frame.tree-mode #farm-action{display:none}

#farm-kind button{pointer-events:auto}#game-frame.farm-work-mode .woodcut-record>span{display:none}#game-frame.farm-work-mode .woodcut-record>#farm-kind,#game-frame.farm-work-mode .woodcut-record>#tree-stock{display:flex}#game-frame.farm-work-mode:not(.tree-mode) .woodcut-record>#farm-status,#game-frame.farm-work-mode:not(.tree-mode) .woodcut-record>#farm-stock{display:block}#game-frame.tree-mode .woodcut-record>#tree-status{display:block}#game-frame.farm-work-mode #bed-mode,#game-frame.farm-work-mode #furniture-mode,#game-frame.farm-work-mode #storage-mode,#game-frame.farm-work-mode #cooking-mode,#game-frame.farm-work-mode #fishing-mode,#game-frame.farm-work-mode #build-mode,#game-frame.farm-work-mode #harvest{display:none}

#game-frame.farm-work-mode #tree-action,#game-frame.farm-work-mode #farm-action,#game-frame.farm-work-mode #farm-mode{max-width:134px}

#game-frame.mining-mode-active .woodcut-record>span{display:none}#game-frame.mining-mode-active .woodcut-record>#resource-stock,#game-frame.mining-mode-active .woodcut-record>#woodcut-target{display:block}#game-frame.mining-mode-active .woodcut-record{top:var(--work-hud-top,122px);max-width:calc(100% - 166px);line-height:1.3}#game-frame.mining-mode-active #bed-mode,#game-frame.mining-mode-active #furniture-mode,#game-frame.mining-mode-active #storage-mode,#game-frame.mining-mode-active #cooking-mode,#game-frame.mining-mode-active #fishing-mode,#game-frame.mining-mode-active #farm-mode,#game-frame.mining-mode-active #build-mode{display:none}

#bench-recipes{display:flex;gap:6px;flex-wrap:wrap}#bench-recipes[hidden]{display:none}#bench-recipes button{pointer-events:auto;min-height:44px;font-size:12px;padding:6px 8px}#game-frame.furniture-mode-active .woodcut-record>#bench-recipes:not([hidden]){display:flex}#game-frame.furniture-mode-active .woodcut-record{max-width:calc(100% - 166px)}#game-frame.furniture-mode-active #furniture-action,#game-frame.furniture-mode-active #furniture-kind,#game-frame.furniture-mode-active #furniture-rotate{max-width:134px;font-size:12px;padding:6px 8px}

#game-frame #furniture-kind,#game-frame #farm-potato-select{pointer-events:auto;min-height:44px;max-width:134px;border:1px solid #a6bdb4;border-radius:9px;background:#fffef5;color:#213f38;font:inherit;font-size:12px;padding:6px}#game-frame.furniture-mode-active #bench-recipes button{min-height:44px}#game-frame.furniture-mode-active .woodcut-record{max-width:calc(100% - 166px)}

#farm-fruit-select,#eat-apple{min-height:44px;max-width:100%;white-space:normal}#eat-apple{pointer-events:auto;font-size:12px;padding:6px 8px}

.life-panel{position:absolute;right:12px;top:var(--work-hud-top,128px);width:min(330px,calc(100% - 24px));max-height:calc(100% - var(--work-hud-top,128px) - 170px);overflow:auto;z-index:4;background:rgba(248,250,242,.97);color:#233527;border:1px solid #697e61;border-radius:12px;padding:10px;box-sizing:border-box;font-size:14px}.life-panel[hidden]{display:none}.life-panel label{display:block}.life-panel p{margin:6px 0;overflow-wrap:anywhere}.life-panel button,.life-panel select,.life-panel textarea{min-height:44px;max-width:100%;box-sizing:border-box;font:inherit}.life-panel button{margin:3px 2px}.life-panel select,.life-panel textarea{width:100%}.life-panel textarea{resize:vertical}.life-panel button:disabled{opacity:.55}@media(max-width:600px){.life-panel{font-size:13px}}

#game-frame.farm-work-mode:not(.tree-mode) .woodcut-record>#country-inventory{display:block;overflow-wrap:anywhere}

@media(max-width:600px){.life-panel.life-action-active{visibility:hidden;pointer-events:none}}

/* Fishing inventory stays inside the game and scrolls independently. */
.fish-species-panel{position:absolute;right:12px;top:110px;z-index:4;box-sizing:border-box;width:190px;max-width:calc(100% - 24px);max-height:min(300px,45%);overflow-y:auto;overflow-x:hidden;padding:10px 12px;border:1px solid #536c67;border-radius:10px;background:rgba(18,38,35,.94);color:#fff;pointer-events:auto}.fish-species-panel[hidden]{display:none}.fish-species-panel>div{display:flex;justify-content:space-between;gap:12px;padding:3px 0}.fish-species-panel b{font-variant-numeric:tabular-nums}@media(max-width:600px){.fish-species-panel{top:105px;right:8px;width:160px;max-height:180px;font-size:12px;padding:7px 9px}}

.cook-fish-panel{position:absolute;right:12px;top:110px;z-index:4;max-width:calc(100% - 24px);box-sizing:border-box;background:#fffef5f2;color:#213f38;border:1px solid #a6bdb4;border-radius:8px;padding:8px;font-size:12px}.cook-fish-panel[hidden]{display:none}.cook-fish-panel p{margin:6px 0 0}#cook-fish-kind,#storage-fish-kind{max-width:100%;min-height:44px;font:inherit}.storage-panel label{display:inline-flex;align-items:center;gap:5px;margin:2px 5px 4px 0}@media(max-width:600px){.cook-fish-panel{top:105px;right:8px;max-width:175px;padding:7px}}

/* Keep the cooking and eating view clear; restore ordinary readouts on exit. */
#game-frame.cooking-mode-active .woodcut-record>span{display:none}#game-frame.cooking-mode-active .woodcut-record>#cooking-status{display:block}#game-frame.cooking-mode-active .woodcut-record{box-sizing:border-box;max-width:min(320px,calc(100% - 204px));line-height:1.35}

.wildlife-panel{position:absolute;top:var(--work-hud-top,122px);left:12px;z-index:4;box-sizing:border-box;max-width:min(320px,calc(100% - 24px));max-height:190px;overflow-y:auto;overflow-x:hidden;background:#fffef5f2;border:1px solid #a6bdb4;border-radius:8px;padding:8px;font-size:12px}.wildlife-panel[hidden]{display:none}.wildlife-panel p{margin:5px 0;overflow-wrap:anywhere}.wildlife-panel button{max-width:100%}#game-frame.wildlife-mode-active .woodcut-record{display:none}#game-frame.wildlife-mode-active .action-pad>button:not([data-hold]){display:none}#game-frame.wildlife-mode-active .lookbar>button:not(#wildlife-mode){display:none}@media(max-width:600px){.wildlife-panel{left:8px;max-width:calc(100% - 16px);max-height:190px}}

.living-panel,.living-map-panel{position:absolute;left:12px;top:var(--work-hud-top,122px);z-index:8;box-sizing:border-box;width:min(360px,calc(100% - 24px));max-height:calc(100% - var(--work-hud-top,122px) - 16px);overflow:auto;background:#fffef5f5;border:1px solid #a6bdb4;border-radius:9px;padding:9px;font-size:12px}.living-panel[hidden],.living-map-panel[hidden]{display:none}.living-panel button,.living-map-panel button,.living-panel select,.living-map-panel input,.living-map-panel select{box-sizing:border-box;max-width:100%;min-height:44px;white-space:normal;overflow-wrap:anywhere}.living-panel label,.living-map-panel label{display:block}.living-map-panel{width:min(680px,calc(100% - 24px))}.living-map-panel canvas{display:block;width:100%;height:auto;aspect-ratio:2/1}.living-map-panel p,.living-panel p{overflow-wrap:anywhere;margin:6px 0}.living-shortcuts{flex:0 0 100%;min-width:0;pointer-events:none}.living-shortcuts-buttons{display:flex;flex-wrap:wrap;gap:6px;width:178px;max-width:calc(55vw - 64px);pointer-events:none}#living-mode,#living-map-toggle{position:static;min-height:44px;font-size:12px;max-width:100%;pointer-events:auto}#storage-row-dried[hidden]{display:none}@media(max-width:600px){.living-panel,.living-map-panel{left:8px;width:calc(100% - 16px);max-height:calc(100% - var(--work-hud-top,122px) - 16px)}}

#game-frame.living-mode-active .woodcut-record,#game-frame.living-map-active .woodcut-record{display:none}#game-frame.living-mode-active .lookbar>button,#game-frame.living-map-active .lookbar>button{display:none}#game-frame.living-mode-active .action-pad>button:not([data-hold]),#game-frame.living-map-active .action-pad>button{display:none}#game-frame.living-mode-active #living-map-toggle{display:none}#game-frame.living-map-active #living-mode{display:none}

/* Pet homestead panel stays inside the existing game frame. */
#pet-toggle{position:absolute;right:12px;top:var(--work-hud-top,122px);z-index:7;min-height:44px;max-width:145px;font-size:12px}.pet-panel{position:absolute;left:12px;top:var(--work-hud-top,122px);width:min(360px,calc(100% - 24px));max-height:calc(100% - var(--work-hud-top,122px) - 12px);overflow:auto;box-sizing:border-box;z-index:9;background:#fffef5f5;border:1px solid #a6bdb4;border-radius:9px;padding:8px;font-size:12px}.pet-panel[hidden]{display:none}.pet-heading{display:flex;align-items:center;gap:6px}.pet-heading label{flex:1}.pet-panel label{display:block}.pet-panel input,.pet-panel select{width:100%;box-sizing:border-box;min-height:44px;font:inherit}.pet-panel button{min-height:44px;max-width:100%;white-space:normal;font:inherit;margin:2px}.pet-panel p{overflow-wrap:anywhere;margin:5px 0}#pet-buttons{display:grid;grid-template-columns:1fr 1fr;gap:2px}#pet-buttons button[hidden]{display:none}#game-frame.pet-mode-active .woodcut-record,#game-frame.pet-mode-active .lookbar>button,#game-frame.pet-mode-active .living-shortcuts,#game-frame.pet-mode-active .action-pad>button:not([data-hold]){display:none}#game-frame.living-mode-active #pet-toggle,#game-frame.living-map-active #pet-toggle{display:none}@media(max-width:600px){.pet-panel{left:8px;width:calc(100% - 16px);font-size:12px}#pet-toggle{right:8px;max-width:115px}}@media(max-height:500px){.pet-panel{top:8px;right:8px;left:auto;width:min(390px,calc(100% - 150px));max-height:calc(100% - 16px)}.pet-panel #pet-counts{font-size:11px}}

.pet-panel #pet-counts[hidden],.pet-panel #pet-dog-status[hidden],.pet-panel label[hidden]{display:none}.pet-panel #pet-perform{width:calc(100% - 4px)}@media(max-height:500px){.pet-panel p{margin:2px 0}.pet-panel{padding:5px}.pet-heading>button{min-height:44px}.pet-panel label{line-height:1.1}}

/* Fit only the new pet workflow to the available narrow viewport. */
#game-frame.pet-fit-active:not(.expanded){height:var(--pet-frame-height);min-height:0}
#game-frame.pet-mode-active #pet-toggle{display:none}
#game-frame.pet-fit-active .pet-panel{top:var(--work-hud-top,76px);max-height:calc(100% - var(--work-hud-top,76px) - 182px);overscroll-behavior:contain}
#game-frame.pet-fit-active .pet-heading{position:sticky;top:-5px;background:#fffef5;z-index:1}
@media(orientation:landscape) and (max-height:600px){#game-frame.pet-fit-active .pet-panel{left:auto;right:110px;top:var(--work-hud-top,76px);width:min(390px,calc(100% - 282px));max-height:calc(100% - var(--work-hud-top,76px) - 28px)}}

/* Keep the four utility buttons on one row only in the narrow fitted view. */
@media(max-width:600px){#game-frame.pet-fit-active .topbar{flex-wrap:nowrap;gap:4px}#game-frame.pet-fit-active .topbar>button{font-size:12px;padding-inline:8px;min-width:44px;min-height:44px;height:44px;white-space:nowrap;flex-shrink:0}}

/* Fishing controls occupy one clear column while that workflow is active. */
#game-frame.fishing-mode-active .action-pad>button:not(#fishing-mode):not(#fish-action),
#game-frame.fishing-mode-active .action-pad>select,
#game-frame.fishing-mode-active .dpad,
#game-frame.fishing-mode-active .lookbar,
#game-frame.fishing-mode-active #pet-toggle{display:none}
#game-frame.fishing-mode-active .woodcut-record>:not(#fishing-status){display:none}
#game-frame.fishing-mode-active .woodcut-record{top:68px;max-width:min(260px,calc(100% - 214px))}
#game-frame.fishing-mode-active .action-pad{gap:8px}
#game-frame.fishing-mode-active .fish-species-panel{top:110px;max-height:min(300px,calc(100% - 246px))}

/* The journal shares the existing fishing panel and its responsive height. */
.fishing-journal-toggle{min-height:44px;width:100%;margin:5px 0;font:inherit}.fishing-journal p{margin:7px 0;overflow-wrap:anywhere}.fishing-journal strong,.fishing-journal span{display:block}.fish-species-panel.journal-open{width:min(290px,calc(100% - 24px))}.fish-species-panel>div[hidden]{display:none}
@media(max-width:600px){.fish-species-panel.journal-open{width:160px}}

#game-frame:has(#life-panel:not([hidden])) #pet-toggle{display:none}

.river-pebble-pick{position:absolute;left:50%;bottom:145px;transform:translateX(-50%);z-index:12;max-width:90%;min-height:44px;background:#fff8df;color:#293c2b;border:2px solid #486342;border-radius:8px;padding:8px 14px;font-weight:bold}.river-pebble-pick[hidden]{display:none}@media(max-height:500px){.river-pebble-pick{bottom:76px;left:62%;font-size:13px;min-height:40px}}

.meal-book{position:absolute;inset:70px 12px 78px;z-index:22;margin:auto;max-width:520px;background:#fff9e9;color:#293c2b;border:2px solid #486342;border-radius:10px;padding:12px;display:flex;flex-direction:column;gap:8px;overflow:hidden;text-align:left}.meal-book[hidden]{display:none}.meal-book-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.meal-book h2,.meal-book p{margin:0}.meal-book p{font-size:13px;line-height:1.5}.meal-book-heading button{min-height:42px}.meal-book-scroll{overflow:auto;min-height:0;overscroll-behavior:contain}.meal-book table{width:100%;border-collapse:collapse;font-size:14px}.meal-book th,.meal-book td{padding:6px 8px;border-bottom:1px solid #d3d9c4}.meal-book td{text-align:right}@media(max-height:500px){.meal-book{inset:38px 8px 40px;padding:8px;gap:4px}.meal-book p{font-size:11px}.meal-book table{font-size:12px}.meal-book th,.meal-book td{padding:4px 6px}}

.book-tabs{display:flex;gap:8px}.book-tabs button{min-height:40px;flex:1}.book-tabs button[aria-selected="true"]{background:#486342;color:#fff}.meal-book-view{display:flex;flex-direction:column;gap:8px;min-height:0;overflow:hidden;flex:1}.meal-book-view[hidden]{display:none}.goal-book-view{overflow:auto;overscroll-behavior:contain}.goal-book-view select,.goal-book-view button{min-height:42px;flex-shrink:0}.goal-book-view ol{margin:0;padding-left:24px}.goal-book-view li{margin:6px 0;font-size:14px}.meal-book-scroll{flex:1}@media(max-height:500px){.book-tabs button{min-height:34px}.meal-book-view{gap:4px}.goal-book-view select,.goal-book-view button{min-height:36px}.goal-book-view li{margin:3px 0;font-size:12px}}
#meal-book-toggle,#meal-book,#meal-book button,#meal-book select{pointer-events:auto}

.gift-book-view{overflow:auto;overscroll-behavior:contain}.gift-book-view select,.gift-book-view button{min-height:42px;flex-shrink:0}.gift-book-actions{display:flex;gap:8px}.gift-book-actions button{flex:1}@media(max-height:500px){.gift-book-view select,.gift-book-view button{min-height:36px}}

/* Context actions reuse existing guarded controls and inventory nodes. */
#game-frame .context-suppressed{display:none!important}
#game-frame #context-dock{display:flex;flex-direction:column;align-items:flex-end;gap:6px;pointer-events:auto;max-width:100%}
#game-frame #context-dock>button{max-width:100%;white-space:normal;min-height:44px;font-size:13px}
#game-frame #context-menu{position:absolute;right:12px;top:70px;z-index:12;background:#fffef5f5;border:1px solid #a6bdb4;border-radius:9px;padding:10px;width:min(390px,calc(100% - 24px));max-height:calc(100% - 100px);overflow:auto;overscroll-behavior:contain;font-size:13px}
.context-menu-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
#context-menu-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
#game-frame #context-menu-items>button{position:static;max-width:100%;width:100%;min-height:44px;white-space:normal;margin:0;font-size:13px}
#game-frame .woodcut-record>span{display:none!important}
#game-frame .woodcut-record>.context-status:not([hidden]){display:block!important}
#game-frame .woodcut-record:not(:has(>.context-status:not([hidden]))){display:none!important}
#game-frame .lookbar:empty{display:none}
#game-frame #context-dock .context-current{display:block}
#game-frame #context-menu-toggle{font-size:12px}
@media(max-width:600px){#game-frame #context-menu{right:8px;top:110px;width:calc(100% - 16px);max-height:calc(100% - 125px)}#game-frame #context-dock>button{font-size:12px}#game-frame .topbar{left:8px;max-width:none}}
@media(orientation:landscape) and (max-height:600px){#game-frame #context-menu{top:62px;max-height:calc(100% - 74px)}}

/* Five configurable tool slots; server inventory and original assets are unchanged. */
#game-frame #tool-hotbar{position:absolute;left:50%;bottom:30px;transform:translateX(-50%);display:flex;gap:4px;z-index:4;max-width:calc(100% - 16px);background:#fffef5df;padding:4px;border-radius:9px}
#game-frame #tool-hotbar button{min-width:44px;min-height:44px;padding:6px 9px;font-size:13px;white-space:nowrap}
#game-frame #tool-hotbar button[aria-pressed="true"]{background:#2d6654;color:#fff;border-color:#1a493c;box-shadow:inset 0 0 0 2px #fff5}
#tool-hotbar small{font-size:10px}
@media(max-width:600px){#game-frame #tool-hotbar{bottom:29px;width:calc(100% - 16px);justify-content:center}#game-frame #tool-hotbar button{flex:1;min-width:44px;padding:6px;font-size:12px}#game-frame .touch-controls{bottom:91px}#game-frame #context-menu{max-height:calc(100% - 190px)}}
@media(orientation:landscape) and (max-height:600px){#game-frame #tool-hotbar{bottom:27px}#game-frame .touch-controls{bottom:83px}#game-frame #tool-hotbar button{padding:5px 8px;font-size:12px}}

#game-frame #tool-inventory-toggle{position:absolute;left:50%;bottom:calc(100% + 5px);transform:translateX(-50%);min-width:76px;font-size:12px}
#game-frame #tool-inventory{position:absolute;inset:8px;z-index:24;margin:auto;width:calc(100% - 16px);max-width:540px;max-height:calc(100% - 16px);height:max-content;box-sizing:border-box;background:#fff9e9;color:#293c2b;border:2px solid #486342;border-radius:10px;padding:10px;display:flex;flex-direction:column;gap:8px;overflow:auto;overscroll-behavior:contain;text-align:left}
#game-frame #tool-inventory[hidden]{display:none}.tool-inventory-heading{display:flex;align-items:center;gap:6px}.tool-inventory-heading h2{flex:1;font-size:17px;margin:0}
#game-frame #tool-inventory button{min-width:44px;min-height:44px;padding:6px;font-size:13px;margin:0;white-space:normal}
#tool-inventory p{margin:0;font-size:12px;line-height:1.5}#tool-inventory-owned{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}#tool-inventory-slots{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
#tool-inventory-owned button[aria-pressed="true"]{background:#2d6654;color:#fff;border-color:#1a493c}
#game-frame.tool-inventory-open .touch-controls,#game-frame.tool-inventory-open #context-dock{visibility:hidden}
#game-frame.tool-inventory-open #tool-hotbar{opacity:.65}
@media(min-width:600px){#tool-inventory-owned{grid-template-columns:repeat(6,minmax(0,1fr))}}
@media(max-height:500px){#game-frame #tool-inventory{gap:5px;padding:8px}#tool-inventory-owned{grid-template-columns:repeat(6,minmax(0,1fr))}#tool-inventory p{font-size:11px}}

/* Runtime previews of existing GLB tools. No exported image assets. */
#game-frame #tool-inventory-toggle{position:static;transform:none;min-width:76px;max-width:none}
#game-frame .tool-preview-item{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;overflow:hidden}
.tool-model-preview{display:block;width:100%;height:68px;object-fit:contain;pointer-events:none}
.tool-preview-name{display:block;font-size:11px;line-height:1.2;white-space:nowrap;pointer-events:none}
.tool-preview-number{position:absolute;left:5px;top:3px;font-size:11px;line-height:1;color:#526055;pointer-events:none}
#game-frame .tool-preview-item[aria-pressed="true"] .tool-preview-number{color:inherit}
#game-frame #tool-hotbar .tool-preview-item{min-width:52px;padding:4px 6px}
#tool-hotbar .tool-model-preview{height:48px}
#game-frame #tool-inventory .tool-preview-item{padding:5px 4px}
#game-frame .tool-preview-empty::before{content:"";display:block;width:calc(100% - 12px);height:54px;border:2px dashed #9ba69d;border-radius:4px;pointer-events:none}
#game-frame #tool-hotbar .tool-preview-empty::before{height:48px}
#game-frame .touch-controls{bottom:112px}
@media(max-width:600px){#game-frame #tool-hotbar .tool-preview-item{flex:1;min-width:44px;padding:4px 3px}#game-frame .touch-controls{bottom:128px}#tool-inventory .tool-model-preview{height:64px}#tool-inventory .tool-preview-empty::before{height:64px}}
@media(orientation:landscape) and (max-height:600px){#tool-inventory .tool-model-preview{height:52px}#tool-inventory .tool-preview-empty::before{height:52px}#tool-hotbar .tool-model-preview{height:42px}#game-frame #tool-hotbar .tool-preview-empty::before{height:42px}#game-frame .touch-controls{bottom:105px}}

/* Keep original tool models readable on selected and disabled item buttons. */
#game-frame .tool-model-preview{background:#fffdf3;border:1px solid #e3dfcb;border-radius:5px}

/* Separate owned tools from the five shortcuts used during play. */
#game-frame #tool-hotbar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr))}
.tool-hotbar-title{grid-column:1/-1;text-align:center;font-size:11px;font-weight:700;line-height:14px;color:#294c3d}
#game-frame.tool-inventory-open #tool-hotbar{display:none}
.tool-owned-panel,.tool-shortcut-panel{border:1px solid #c4cbb6;border-radius:8px;padding:7px;display:flex;flex-direction:column;gap:6px}
.tool-owned-panel{background:#fffdf4}.tool-shortcut-panel{background:#e5ecdf;border:2px solid #678168;margin-top:3px}
#tool-inventory h3{font-size:14px;line-height:1.3;margin:0}.tool-shortcut-heading{display:flex;align-items:center;justify-content:space-between;gap:6px}
#tool-inventory-utility button{white-space:nowrap;font-size:12px}
#tool-inventory-utility button[aria-pressed="true"]{background:#2d6654;color:#fff;border-color:#1a493c}
#game-frame .tool-preview-number{font-size:14px;font-weight:700;color:#213f38!important;background:#fffdf3;border:1px solid #c3cbb9;border-radius:3px;padding:1px 3px;left:3px;top:3px}
#game-frame .touch-controls{bottom:148px}
@media(min-width:600px){#tool-inventory-owned{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(max-width:600px){#game-frame .touch-controls{bottom:148px}}
@media(orientation:landscape) and (max-height:600px){#game-frame .touch-controls{bottom:140px}#game-frame #tool-inventory{gap:4px;padding:7px}.tool-owned-panel,.tool-shortcut-panel{padding:5px;gap:4px}#tool-inventory-owned{grid-template-columns:repeat(5,minmax(0,1fr))}#tool-inventory h3{font-size:13px}#tool-inventory .tool-inventory-hint{font-size:11px}}

/* Independent compact inventory and vertical shortcut windows. */
#game-frame #tool-inventory{inset:auto 12px auto auto;top:50%;transform:translateY(-50%);margin:0;width:min(370px,calc(100% - 24px));max-width:none;max-height:calc(100% - 16px);height:auto;background:transparent;border:0;border-radius:0;box-shadow:none;padding:0;display:grid;grid-template-columns:minmax(0,1fr) 96px;gap:16px;overflow:visible;align-items:center}
.tool-owned-window{min-width:0;background:#fff9e9;border:2px solid #486342;border-radius:9px;box-shadow:0 4px 14px #17352b38;padding:8px;display:flex;flex-direction:column;gap:7px}
#tool-inventory .tool-inventory-heading{gap:4px}#tool-inventory .tool-inventory-heading h2{font-size:14px}
#game-frame #tool-inventory .tool-inventory-heading button{padding:5px;font-size:11px}
#tool-inventory .tool-owned-panel{background:transparent;border:0;border-radius:0;padding:0;gap:4px}
#tool-inventory #tool-owned-title{font-size:11px;font-weight:400;color:#536255}
#tool-inventory-owned{grid-template-columns:repeat(3,60px);justify-content:start;gap:6px}
#tool-inventory .tool-shortcut-panel{margin:0;background:#e5ecdf;border:2px solid #486342;border-radius:9px;box-shadow:0 4px 14px #17352b38;padding:6px;gap:6px;min-width:0}
#tool-inventory #tool-shortcut-title{font-size:11px;line-height:16px;white-space:nowrap;text-align:center}
#tool-inventory-slots{grid-template-columns:minmax(0,1fr);gap:4px}
#game-frame #tool-inventory .tool-preview-item{min-width:44px;min-height:56px;height:56px;padding:3px;gap:1px}
#tool-inventory .tool-model-preview{height:36px}
#tool-inventory .tool-preview-name{font-size:10px;line-height:11px}
#game-frame #tool-inventory .tool-preview-empty::before{height:36px}
#game-frame #tool-inventory #tool-inventory-utility button{width:100%;padding:4px;min-height:44px;font-size:10px;white-space:normal}
#tool-inventory .tool-inventory-hint,#tool-inventory #tool-inventory-notice{font-size:11px;line-height:1.4}
#game-frame #tool-hotbar{left:auto;right:12px;top:50%;bottom:auto;transform:translateY(-50%);width:96px;max-width:none;display:grid;grid-template-columns:minmax(0,1fr);padding:6px;gap:4px;border:2px solid #678168;background:#f3f5eaf2}
#tool-hotbar .tool-hotbar-title{grid-column:auto;font-size:11px;line-height:16px;white-space:nowrap}
#game-frame #tool-hotbar .tool-preview-item{min-width:44px;min-height:56px;height:56px;padding:3px;gap:1px}
#tool-hotbar .tool-model-preview{height:36px}
#tool-hotbar .tool-preview-name{font-size:10px;line-height:11px}
#game-frame #tool-hotbar .tool-preview-empty::before{height:36px}
#game-frame .touch-controls{bottom:28px;right:124px}
#game-frame.tool-inventory-open #tool-hotbar{display:none}
@media(max-width:600px){#game-frame #tool-inventory{right:8px;width:calc(100% - 16px);grid-template-columns:minmax(0,1fr) 88px;gap:16px}#game-frame #tool-hotbar{right:8px;width:88px}#game-frame .touch-controls{bottom:28px;right:112px}#game-frame .action-pad{max-width:104px}#game-frame #context-dock{max-width:104px}#game-frame #context-dock>button{max-width:104px;white-space:normal}#tool-inventory #tool-shortcut-title,#tool-hotbar .tool-hotbar-title{font-size:10px}}
@media(orientation:landscape) and (max-height:600px){#game-frame #tool-inventory{right:8px;grid-template-columns:minmax(0,1fr) 88px;gap:16px;width:min(354px,calc(100% - 16px))}.tool-owned-window{padding:6px;gap:5px}#tool-inventory-owned{grid-template-columns:repeat(3,56px);gap:4px}#game-frame #tool-inventory .tool-preview-item,#game-frame #tool-hotbar .tool-preview-item{height:44px;min-height:44px;padding:2px}#tool-inventory .tool-model-preview,#tool-hotbar .tool-model-preview{height:26px}#game-frame #tool-inventory .tool-preview-empty::before,#game-frame #tool-hotbar .tool-preview-empty::before{height:26px}#tool-inventory .tool-preview-name,#tool-hotbar .tool-preview-name{font-size:9px;line-height:10px}#tool-inventory .tool-shortcut-panel{padding:5px;gap:4px}#tool-inventory-slots{gap:3px}#game-frame #tool-hotbar{right:8px;width:88px;padding:5px;gap:3px}#tool-inventory #tool-shortcut-title,#tool-hotbar .tool-hotbar-title{font-size:10px}#game-frame .touch-controls{bottom:28px;right:112px}}

#tool-inventory-slots{justify-items:center}#game-frame #tool-inventory-slots .tool-preview-item{width:60px}#game-frame #tool-hotbar{justify-items:center}#game-frame #tool-hotbar .tool-preview-item{width:60px}
@media(max-width:600px){#game-frame #tool-inventory-slots .tool-preview-item,#game-frame #tool-hotbar .tool-preview-item{width:56px}}

/* One fixed bottom shortcut bar is shared by play and inventory editing. */
#game-frame #tool-inventory{inset:auto;left:50%;top:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);margin:0;width:min(360px,calc(100% - 24px));max-height:calc(100% - 180px);height:auto;background:#fff9e9;border:2px solid #486342;border-radius:9px;box-shadow:0 4px 14px #17352b38;padding:8px;display:flex;flex-direction:column;gap:6px;overflow:auto}
#tool-inventory .tool-inventory-heading{gap:4px}#tool-inventory .tool-inventory-heading h2{font-size:14px;min-width:42px}
#game-frame #tool-inventory #tool-inventory-utility button{width:auto;min-width:44px;max-width:72px;white-space:normal;padding:4px;font-size:10px;line-height:1.2}
#tool-inventory #tool-owned-title{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#tool-inventory-owned{grid-template-columns:repeat(5,60px);justify-content:center;gap:4px}
#game-frame #tool-hotbar{inset:auto;left:50%;right:auto;top:auto;bottom:16px;transform:translateX(-50%);margin:0;width:max-content;max-width:calc(100% - 16px);display:grid;grid-template-columns:repeat(5,60px);justify-items:center;padding:6px;gap:4px;background:#f3f5eaf2;border:2px solid #678168}
#tool-hotbar .tool-hotbar-title{grid-column:1/-1;font-size:11px;line-height:16px}
#game-frame #tool-hotbar .tool-preview-item{width:60px;min-width:44px;height:56px;min-height:56px;flex:none}
#game-frame.tool-inventory-open #tool-hotbar{display:grid;opacity:1}
#game-frame .touch-controls{bottom:128px;left:12px;right:12px}
#game-frame .action-pad,#game-frame #context-dock{max-width:none}
@media(max-width:600px){#tool-inventory-owned{grid-template-columns:repeat(5,56px)}#game-frame #tool-inventory{left:50%;right:auto;width:min(360px,calc(100% - 24px));padding:7px}#game-frame #tool-hotbar{left:50%;right:auto;bottom:16px;grid-template-columns:repeat(5,56px);width:max-content}#game-frame #tool-hotbar .tool-preview-item{width:56px}#game-frame .touch-controls{bottom:128px;left:8px;right:8px}#game-frame .action-pad,#game-frame #context-dock,#game-frame #context-dock>button{max-width:none}}
@media(orientation:landscape) and (max-height:600px){#game-frame #tool-inventory{left:50%;right:auto;top:50%;width:min(360px,calc(100% - 24px));padding:6px;gap:4px;max-height:calc(100% - 110px)}#tool-inventory-owned{grid-template-columns:repeat(5,56px);gap:4px}#game-frame #tool-hotbar{left:50%;right:auto;top:auto;bottom:12px;width:max-content;grid-template-columns:repeat(5,56px);padding:5px;gap:3px}#game-frame #tool-hotbar .tool-preview-item{width:56px;height:44px;min-height:44px}#game-frame .touch-controls{bottom:104px;left:8px;right:8px}#tool-inventory .tool-inventory-hint,#tool-inventory #tool-inventory-notice{font-size:10px;line-height:1.3}}

/* Input settings stay inside the game frame; target names are operation HUD. */
#game-frame #control-settings-toggle{position:relative;z-index:26;font-size:12px}
#game-frame .control-settings{position:absolute;inset:12px;margin:auto;width:min(520px,calc(100% - 24px));height:min(580px,calc(100% - 24px));max-height:calc(100% - 24px);z-index:30;display:flex;flex-direction:column;gap:8px;padding:12px;border:2px solid #486342;border-radius:10px;background:#fff9e9;color:#293c2b;text-align:left;overflow:hidden}
#game-frame .control-settings[hidden]{display:none}
.control-settings-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-shrink:0}.control-settings-head h2{margin:0;font-size:18px}
.control-settings-scroll{min-height:0;overflow:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:10px}
.control-settings-scroll>label{min-height:44px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.control-settings input[type="range"]{min-height:44px;min-width:120px;flex:1}.control-settings input[type="checkbox"]{width:22px;height:22px}
.control-settings-bindings{display:grid;gap:8px}.control-settings-binding{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px}
#game-frame .control-settings button{min-height:44px;min-width:90px;font-size:13px;padding:6px 9px}.control-settings p{margin:0;font-size:12px;line-height:1.5}
#tool-target-label{position:absolute;left:50%;top:55%;transform:translateX(-50%);z-index:3;max-width:calc(100% - 24px);padding:4px 8px;border-radius:5px;background:#fff8e8eb;color:#203c30;font-size:12px;font-weight:700;line-height:1.4;pointer-events:none;text-align:center}
@media(max-width:600px){#game-frame .control-settings{inset:8px;width:calc(100% - 16px);height:calc(100% - 16px);max-height:calc(100% - 16px);padding:10px}.control-settings-binding>span{font-size:13px}}
@media(orientation:landscape) and (max-height:600px){#game-frame .control-settings{inset:6px;height:calc(100% - 12px);max-height:calc(100% - 12px);padding:8px}.control-settings-scroll{gap:6px}#tool-target-label{top:51%}}

#game-frame.storage-mode-active #storage-panel{left:50%;transform:translateX(-50%);bottom:128px;width:min(620px,calc(100% - 24px));max-height:calc(100% - 210px);z-index:20}
.storage-drag{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.storage-drag-help,.storage-drag-status{grid-column:1/-1}.storage-drag-pane{min-width:0;border:1px solid #bdcbb4;background:#f1f5e9;border-radius:6px;padding:6px}.storage-drag-pane h4{font-size:13px;margin:0 0 5px}.storage-drag-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(64px,1fr));gap:4px;max-height:190px;overflow:auto;overscroll-behavior:contain}.storage-drag-item{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:11px!important;min-width:44px!important;min-height:64px;padding:4px!important;overflow-wrap:anywhere}.storage-item-preview{display:block;width:48px;height:34px;object-fit:contain;pointer-events:none;background:#fffdf3;border-radius:4px}.storage-drag-actions{display:flex;gap:4px;margin-top:5px}.storage-drag-actions button{flex:1;min-height:44px;padding:4px!important;font-size:11px!important;white-space:normal}.storage-drag-pane.is-drop-target{outline:3px solid #c49938;outline-offset:-2px}
@media(max-width:600px){#game-frame.storage-mode-active #storage-panel{width:calc(100% - 16px);max-height:calc(100% - 220px)}.storage-drag-grid{grid-template-columns:repeat(auto-fill,minmax(55px,1fr));max-height:150px}.storage-drag{gap:5px}.storage-drag-pane{padding:4px}}
@media(orientation:landscape) and (max-height:600px){#game-frame.storage-mode-active #storage-panel{top:64px;bottom:100px;max-height:calc(100% - 164px)}.storage-drag-grid{max-height:104px}.storage-drag-item{min-height:56px}.storage-item-preview{height:28px}}

#placement-controls{display:grid;grid-template-columns:repeat(3,minmax(44px,1fr));gap:4px;max-width:220px;background:rgba(240,248,241,.96);padding:6px;border-radius:8px;color:#173326}#placement-controls[hidden]{display:none}#placement-controls button{min-width:44px;min-height:44px;font-size:12px}#placement-offset{grid-column:1/-1;font-size:11px;text-align:center}@media(max-height:500px){#placement-controls{grid-template-columns:repeat(6,44px);max-width:none;position:absolute;right:12px;top:110px}#placement-offset{grid-column:1/-1}}

@media(orientation:portrait) and (max-width:600px){#game-frame.storage-mode-active #storage-panel{top:108px;bottom:128px;max-height:calc(100% - 236px)}}

@media(orientation:landscape) and (max-height:600px){
 #game-frame.furniture-mode-active .touch-controls{top:64px;bottom:104px}
 #game-frame.furniture-mode-active .action-pad{position:absolute;right:0;top:0;display:grid;grid-template-columns:148px 120px 120px;grid-template-rows:repeat(3,44px);gap:4px;width:396px;max-width:none;align-items:start}
 #game-frame.furniture-mode-active #placement-controls{position:static;grid-column:1;grid-row:1/4;display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:44px 44px 24px;gap:4px;width:148px;max-width:none;padding:4px;box-sizing:border-box}
 #game-frame.furniture-mode-active #placement-controls[hidden]{display:none}
 #game-frame.furniture-mode-active #placement-controls button{height:44px;min-height:44px;align-self:start;font-size:10px;padding:3px!important}
 #game-frame.furniture-mode-active #placement-offset{grid-column:1/-1;font-size:10px;line-height:12px}
 #game-frame.furniture-mode-active #context-dock{grid-column:2;grid-row:1;width:120px}
 #game-frame.furniture-mode-active #furniture-kind{grid-column:3;grid-row:1}
 #game-frame.furniture-mode-active #furniture-rotate{grid-column:2;grid-row:2}
 #game-frame.furniture-mode-active #furniture-action{grid-column:3;grid-row:2}
 #game-frame.furniture-mode-active .action-pad>[data-hold="run"]{grid-column:2;grid-row:3}
 #game-frame.furniture-mode-active .action-pad>[data-hold="jump"]{grid-column:3;grid-row:3}
 #game-frame.furniture-mode-active #context-dock>button,#game-frame.furniture-mode-active #furniture-kind,#game-frame.furniture-mode-active #furniture-rotate,#game-frame.furniture-mode-active #furniture-action,#game-frame.furniture-mode-active .action-pad>[data-hold]{width:120px;max-width:120px;height:44px;min-height:44px;box-sizing:border-box}
}

@media(orientation:portrait) and (max-width:600px){#game-frame.furniture-mode-active .woodcut-record{top:108px;max-width:calc(100% - 166px)}}

/* Inventory action controls share the existing game dialog and keep the live hotbar. */
#tool-inventory{max-height:calc(100% - 140px);overflow:auto;overscroll-behavior:contain}
.inventory-filters,.inventory-item-actions,.inventory-recipe-materials{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.inventory-filters select,.storage-drag-actions select,.storage-drag-actions input{min-width:0;max-width:100%;font:inherit;padding:5px;border:1px solid #758675;border-radius:5px;background:#fff;color:#233126}
.inventory-resources{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:6px;margin:8px 0}
.inventory-resources button{display:flex;align-items:center;justify-content:center;flex-direction:column;min-width:0;min-height:70px;font-size:12px;overflow-wrap:anywhere}
.inventory-item-actions{padding:7px;background:#eef2e8;border-radius:6px;min-height:35px}
.inventory-item-actions strong{margin-right:auto}.inventory-recipes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:10px}
.inventory-recipes h3,.inventory-recipes>p{grid-column:1/-1;margin:3px 0;font-size:12px}
.inventory-recipe{display:flex;flex-direction:column;align-items:stretch;text-align:left;font-size:11px;gap:3px;min-width:0}
.inventory-recipe-output,.inventory-recipe-materials>span{display:flex;align-items:center;gap:3px;min-width:0}.inventory-recipe canvas,.inventory-resources canvas{width:36px;height:36px;flex:none}
.inventory-recipe-materials canvas{width:24px;height:24px}.storage-drag-actions{flex-wrap:wrap}.storage-drag-actions input{width:5em}
@media(max-width:600px){#tool-inventory{max-height:calc(100% - 115px)}.inventory-resources{grid-template-columns:repeat(4,minmax(0,1fr))}.inventory-recipes{grid-template-columns:1fr}.inventory-filters select{max-width:48%}}
@media(max-height:480px){#tool-inventory{max-height:calc(100% - 90px)}.inventory-resources{grid-template-columns:repeat(6,minmax(0,1fr))}.inventory-recipes{grid-template-columns:repeat(2,minmax(0,1fr))}}

#tool-inventory .inventory-item-actions{position:sticky;top:0;z-index:2;border:1px solid #cad3c3;box-shadow:0 2px 5px #0002;margin:5px 0}
#tool-inventory .inventory-resources{grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
#tool-inventory .inventory-resources button{min-height:54px;padding:3px;font-size:10px;line-height:1.15}
#tool-inventory .inventory-resources canvas{width:30px;height:23px}
.inventory-recipe-details>summary{cursor:pointer;font-size:12px;padding:7px 4px;font-weight:700}
@media(max-height:480px){#tool-inventory .inventory-resources{grid-template-columns:repeat(6,minmax(0,1fr))}}

#game-frame #tool-inventory{overflow-x:hidden}

@media(max-width:600px){#game-frame #tool-inventory{max-height:calc(100% - 240px)}}

@media(max-height:520px) and (min-width:601px){#game-frame #tool-inventory{top:64px;bottom:100px;transform:translateX(-50%);height:auto;max-height:none;min-height:0}}

#game-frame #tool-inventory .inventory-item-actions:empty{display:none}

/* Compact controls stay inside the existing game frame. */
#game-frame .context-target-cycle{display:flex;align-items:center;justify-content:center;gap:3px;max-width:100%;font-size:11px}
#game-frame .context-target-cycle button{min-width:30px;min-height:30px;padding:3px;font-size:16px}
#context-target-status{min-width:0;overflow-wrap:anywhere}
#game-frame .tool-ring[hidden]{display:none}
#game-frame .tool-ring{position:absolute;z-index:35;left:50%;top:50%;transform:translate(-50%,-50%);width:min(300px,calc(100% - 20px));padding:8px;border:2px solid #486342;border-radius:14px;background:#fff9e9;box-shadow:0 4px 14px #17352b38;color:#293c2b;text-align:center;box-sizing:border-box}
.tool-ring__items{position:relative;width:100%;aspect-ratio:1;border-radius:50%;background:#e6ecdd}
#game-frame .tool-ring__item{position:absolute;left:var(--ring-x);top:var(--ring-y);transform:translate(-50%,-50%);width:60px;height:60px;min-width:44px;padding:3px;font-size:10px;line-height:1.1}
#game-frame .tool-ring__item .tool-model-preview{height:36px}#game-frame .tool-ring__item .tool-preview-name{font-size:10px}
#game-frame .tool-ring__item.is-pointed{background:#2d6654;color:#fff;outline:3px solid #b0c66a}
.tool-ring__status{font-size:11px;margin:4px 0}.tool-ring__cancel{min-height:32px}
.storage-matching{grid-column:1/-1;min-width:0;border-top:1px solid #c4cbb6;padding-top:5px;font-size:11px}
.storage-matching p{margin:3px 0}.storage-matching .storage-drag-grid{max-height:94px;overflow:auto}.storage-matching button{font-size:11px;padding:4px}
@media(max-height:520px){#game-frame .tool-ring{width:230px;padding:5px}#game-frame .tool-ring__item{width:50px;height:50px}.tool-ring__status{margin:2px 0}}

@media(max-height:520px){#game-frame .tool-ring{top:64px;transform:translateX(-50%);width:160px;padding:5px}#game-frame .tool-ring__item{width:44px;height:44px;min-height:44px}#game-frame .tool-ring__item .tool-model-preview{height:24px}#game-frame .tool-ring__cancel{min-height:44px}}

@media(max-height:520px) and (min-width:601px){
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .touch-controls{top:112px;bottom:104px}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .action-pad{position:absolute;right:0;top:0;display:grid;grid-template-columns:148px 120px 120px;grid-template-rows:repeat(3,44px);gap:4px;width:396px;max-width:none;align-items:start}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #placement-controls{position:static;grid-column:1;grid-row:1/4;display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:44px 44px 24px;gap:4px;width:148px;max-width:none;padding:4px;box-sizing:border-box}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #placement-controls[hidden]{display:none}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #placement-controls button{height:44px;min-height:44px;align-self:start;font-size:10px;padding:3px!important}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #placement-offset{grid-column:1/-1;font-size:10px;line-height:12px}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #context-dock{grid-column:2;grid-row:1;width:120px}
 #game-frame:is(.bed-mode-active,.storage-mode-active) :is(#bed-action,#storage-action){grid-column:3;grid-row:1}
 #game-frame.bed-mode-active #bed-rotate{grid-column:2;grid-row:2}
 #game-frame.bed-mode-active #clear-resume-bed{grid-column:3;grid-row:2}
 #game-frame.bed-mode-active #set-resume-bed{grid-column:1;grid-row:1}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .action-pad>[data-hold="run"]{grid-column:2;grid-row:3}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .action-pad>[data-hold="jump"]{grid-column:3;grid-row:3}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) :is(#context-dock>button,#bed-action,#storage-action,#bed-rotate,#clear-resume-bed,#set-resume-bed,.action-pad>[data-hold]){width:120px;max-width:120px;height:44px;min-height:44px;box-sizing:border-box}
}

@media(max-height:520px) and (min-width:601px){#game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #context-dock{padding:0;margin:0;height:44px;align-self:start}}

@media(max-height:520px) and (min-width:601px){#game-frame.bed-mode-active #set-resume-bed{grid-column:2;grid-row:2;width:120px;height:44px;min-height:44px;box-sizing:border-box;font-size:10px;line-height:1.2;padding:3px}}

@media(max-height:520px) and (min-width:601px){#game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #context-target-cycle{display:none}}

#game-frame #previous-tool{max-width:100px;min-height:44px;font-size:10px;line-height:1.2;padding:5px;white-space:normal}
#game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .woodcut-record>#placement-align-controls:not([hidden]){display:flex!important;align-items:center;gap:5px;flex-wrap:wrap;pointer-events:auto}
#game-frame #placement-align{font-size:11px;line-height:1.2;padding:4px 6px;min-height:44px;max-width:180px;pointer-events:auto}
#placement-align-status{font-size:10px;line-height:1.3;max-width:230px}
.storage-name-controls{grid-column:1/-1;min-width:0;font-size:12px}.storage-name-controls strong{display:block;overflow-wrap:anywhere}
.storage-name-controls summary{cursor:pointer;font-size:11px}.storage-name-controls label{font-size:11px;margin:2px 0}
#game-frame .storage-name-controls input{width:min(240px,100%);min-height:44px;font:inherit;box-sizing:border-box}
#game-frame .storage-name-controls button{min-height:44px;font-size:11px;padding:4px 6px}.storage-name-controls p{font-size:11px;overflow-wrap:anywhere}

.storage-name-heading{display:flex;align-items:center;justify-content:space-between;gap:6px}.storage-name-heading strong{flex:1;min-width:0}#game-frame #storage-panel-close{flex:none;min-width:44px;min-height:44px;font-size:11px;padding:4px 6px}

@media(max-height:520px) and (min-width:601px){
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .woodcut-record{max-width:calc(100% - 424px)}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .action-pad{grid-template-rows:repeat(3,44px) 32px}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) .action-pad>#placement-align-controls:not([hidden]){display:contents!important}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #placement-align{grid-column:1;grid-row:4;align-self:start;margin-top:-12px;width:148px;max-width:148px;height:44px;min-height:44px;box-sizing:border-box;font-size:10px;line-height:1.2;padding:3px}
 #game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active) #placement-align-status{grid-column:2/4;grid-row:4;align-self:center;display:block;max-width:244px;font-size:10px;line-height:1.2}
}

#context-menu-items>.life-menu-group-title{grid-column:1/-1;margin:6px 0 0;font-size:12px;line-height:1.3;border-top:1px solid #cfdbc9;padding-top:6px}
#context-menu-items>.life-menu-group-hint{grid-column:1/-1;margin:0;font-size:11px;line-height:1.4;color:#536255}
#context-menu>p{font-size:11px;line-height:1.5;margin:8px 0 0}
.inventory-recipe-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;margin:4px 0}
#game-frame #tool-inventory .inventory-recipe-filters input[type="search"]{grid-column:1/-1;min-width:0;max-width:100%;min-height:44px;font:inherit;font-size:12px;padding:5px}
.inventory-recipe-filters select{min-width:0;max-width:100%;min-height:44px;font:inherit;font-size:11px;background:#fffdf3;border:1px solid #9daf96;border-radius:5px;padding:4px}
.inventory-recipe-filters label{grid-column:1/-1;display:flex;align-items:center;gap:5px;font-size:11px;min-height:32px}.inventory-recipe-filters input[type="checkbox"]{width:18px;height:18px;margin:0}
.inventory-recipe-card{display:flex;flex-direction:column;gap:3px;min-width:0}.inventory-recipe-card>.inventory-recipe{width:100%;height:100%}
#game-frame #tool-inventory .inventory-recipe-guide{font-size:10px;min-height:44px;padding:4px;line-height:1.2}
.inventory-recipe-shortage{color:#8b352c;font-weight:600}.inventory-recipe-status{font-size:11px;color:#743d28}
#fishing-region-hint{font-size:11px;line-height:1.4;margin:4px 0}
.exploration-navigation{position:absolute;left:50%;top:calc(var(--work-hud-top,122px) + 56px);bottom:auto;transform:translateX(-50%);z-index:3;max-width:min(310px,calc(100% - 24px));padding:3px 6px;background:#fff8e8e8;border-radius:5px;font-size:11px;line-height:1.4;pointer-events:none}
.living-map-legend{font-size:11px;line-height:1.4}.living-map-panel #exploration-message{font-size:11px}
#game-frame:is(.furniture-mode-active,.bed-mode-active,.storage-mode-active,.farm-work-mode,.cooking-mode-active,.fishing-mode-active) #exploration-navigation{display:none}
@media(max-width:600px){.exploration-navigation{left:50%;bottom:auto}.inventory-recipes{grid-template-columns:1fr}}
@media(max-height:520px) and (min-width:601px){.exploration-navigation{bottom:auto}#game-frame #context-menu{top:112px;max-height:calc(100% - 124px)}}

.housing-controls{position:absolute;z-index:35;top:12px;right:12px;width:min(360px,calc(100% - 24px));max-height:min(calc(100% - 24px),var(--housing-visible-height,calc(100dvh - 24px)));overflow:auto;box-sizing:border-box;background:#f5f0df;color:#283521;border:1px solid #72805c;border-radius:10px;padding:12px;overscroll-behavior:contain}.housing-controls[hidden]{display:none}.housing-controls label{display:flex;align-items:center;gap:8px;min-height:44px}.housing-controls select,.housing-controls button{min-height:44px;max-width:100%}.housing-controls select{flex:1;min-width:0}.housing-controls fieldset{margin:8px 0;border:1px solid #a6ae96}.housing-heading{display:flex;align-items:center;justify-content:space-between}.housing-controls [data-preview]{width:100%;min-height:96px}.housing-controls .storage-item-preview{width:128px;height:96px}.housing-controls input[type=checkbox]{width:22px;height:22px}.housing-controls p{font-size:14px;line-height:1.5}

/* Keep the original life exit above the scrollable actions, never behind them. */
#game-frame .life-panel-heading{position:sticky;top:-10px;z-index:1;display:flex;justify-content:flex-end;background:rgba(248,250,242,.99);padding-bottom:6px;margin-bottom:4px;border-bottom:1px solid #cbd5c5}
#game-frame .life-panel-heading:empty{display:none}
#game-frame .life-panel-heading>button{margin:0}
