/* V0.12 compact inventory, separate crafting and persistent five-slot hotbar. */
#hotbar{z-index:4;pointer-events:auto}
#hotbar .slot{display:grid;grid-template-columns:13px 1fr;grid-template-rows:1fr auto;align-items:center;text-align:left;color:#eee5c9;cursor:pointer;touch-action:manipulation}
#hotbar .slot small{font-size:9px;color:#d5c18f;align-self:start}
#hotbar .slot .hotbar-icon{font-size:19px;text-align:center;line-height:1}
#hotbar .slot b{grid-column:1/3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
#hotbar .slot .qty{font-weight:700}
#game-shell:has(#menu:not(.hidden)) #hotbar{z-index:12}
#menu.inventory-panel,#menu.craft-panel{inset:auto;left:50%;top:50%;transform:translate(-50%,-50%);width:min(580px,calc(100% - 28px));height:min(330px,calc(100% - 104px));min-height:190px;overflow:hidden;display:flex;flex-direction:column;gap:7px;padding:12px 14px;box-shadow:0 12px 38px #050b07aa}
#menu.inventory-panel{width:min(510px,calc(100% - 28px));height:min(285px,calc(100% - 104px))}
#menu .menu-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex:none}
#menu .menu-head h2{margin:0;font-size:16px;white-space:nowrap}
#menu .menu-head h2 small{font-size:11px;color:#b1c5ae}
#menu .menu-head #close-menu{width:auto;min-width:58px;min-height:34px;margin:0;padding:4px 10px}
#menu .inventory-tabs{display:flex;gap:4px;flex:none;overflow-x:auto;scrollbar-width:none}
#menu .inventory-tabs button{width:auto;min-width:50px;flex:1;white-space:nowrap;margin:0;padding:6px 5px;font-size:11px}
#menu .inventory-tabs button.active{background:#23372b;box-shadow:inset 0 3px 7px #07100b99,inset 0 0 0 1px #d4bb7f;border-color:#c7ad74;color:#f8e3a3}
#menu .inventory-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-rows:62px;gap:5px;overflow:auto;min-height:0;flex:1;align-content:start;overscroll-behavior:contain;touch-action:pan-y}
#menu .inventory-grid .inventory-cell{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:2px;width:100%;height:62px;min-width:0;margin:0;padding:3px;touch-action:none;user-select:none;-webkit-user-select:none;border-color:#83947377;background:#21352acb}
#menu .inventory-cell.chosen{border-color:#e6cc85;background:#3a4c36}
#menu .inventory-cell:disabled{opacity:.42}
#menu .item-icon{font-size:21px;line-height:1}
#menu .item-name{max-width:100%;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#menu .item-count{position:absolute;right:4px;top:2px;font-size:10px;color:#f3dda0}
#menu .inventory-detail{flex:none;display:flex;align-items:center;gap:8px;min-height:39px;max-height:62px;overflow:auto;font-size:11px}
#menu .inventory-detail>b{white-space:nowrap}
#menu .inventory-detail>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#menu .inventory-detail small{white-space:nowrap;color:#d7bc87}
#menu .item-actions{display:flex;gap:4px;margin-left:auto;flex:none}
#menu .item-actions button{width:auto;min-height:30px;margin:0;padding:3px 8px;font-size:11px}
#menu .empty-filter{grid-column:1/-1;text-align:center;color:#b9c3a9}
#menu .recipe-list{overflow:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;align-content:start}
#menu .craft-tabs{display:flex;gap:4px;flex:none;overflow-x:auto;scrollbar-width:none}
#menu .craft-tabs button{width:auto;min-width:54px;flex:1;margin:0;padding:5px 6px;font-size:11px;white-space:nowrap}
#menu .craft-tabs button.active{background:#23372b;box-shadow:inset 0 3px 7px #07100b99,inset 0 0 0 1px #d4bb7f;border-color:#c7ad74;color:#f8e3a3}
#menu .craft-body{display:grid;grid-template-columns:minmax(140px,38%) minmax(0,1fr);gap:9px;min-height:0;flex:1}
#menu .craft-body .recipe-list{display:flex;flex-direction:column;gap:4px;min-height:0;overscroll-behavior:contain;touch-action:pan-y}
#menu .craft-body .recipe{display:flex;flex:none;justify-content:flex-start;height:43px;width:100%;margin:0;text-align:left}
#menu .craft-body .recipe b{font-size:12px}
#menu .craft-detail{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}
#menu .craft-materials{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px 8px;min-height:0;overflow:auto;padding:4px 1px;align-content:start}
#menu .craft-material{display:flex;justify-content:space-between;gap:4px;font-size:11px;white-space:nowrap}
#menu .craft-material b{color:#b9dfaa}.craft-material.missing b{color:#ee9c80}
#menu .craft-footer{display:flex;align-items:center;gap:5px;margin-top:auto;padding-top:3px;border-top:1px solid #9bad8a55;min-height:28px}
#menu .craft-footer small{flex:1;min-width:0;max-height:32px;overflow:auto;white-space:normal;font-size:10px;line-height:1.2}
#menu .craft-missing{color:#efa58e}.craft-ready{color:#b9dfaa}
#menu .craft-footer button{width:auto;min-width:58px;min-height:26px;margin:0;padding:3px 6px;font-size:11px;flex:none}
#menu .recipe{display:flex;align-items:center;justify-content:space-between;gap:5px;min-width:0;padding:5px 7px;border:1px solid #7c916b66;border-radius:6px;background:#1c3026}
#menu .recipe div{min-width:0}.recipe b,.recipe small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.recipe small{font-size:10px;color:#c1cbaa}
#menu .recipe button{width:auto;min-width:50px;margin:0;padding:5px;font-size:11px;flex:none}
#menu .concept-art{display:block;flex:none;width:34px;height:34px;border-radius:5px;background-color:#eeeade;background-size:300% 500%;background-repeat:no-repeat;box-shadow:inset 0 0 0 1px #a89f85;overflow:hidden}
#menu .concept-art svg{width:100%;height:100%;display:block}
#menu .concept-art.large{width:62px;height:62px}
#menu .concept-art.model-preview{background:transparent;box-shadow:none;overflow:visible}
#menu .model-preview img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 2px #10190b55)}
#menu .item-icon .concept-art{width:31px;height:31px;margin:auto}
#menu .recipe-art-missing{display:grid;place-items:center;flex:none;width:34px;height:34px;background:#455742;border-radius:5px;color:#e5d6a9}
#menu .recipe{cursor:pointer}
#menu .recipe.recipe-selected{border-color:#e2c47d;background:#354532}
#menu .craft-selected-preview{display:flex;align-items:center;gap:10px;flex:none;min-height:68px;padding:3px 6px;border-radius:7px;background:#263b2c;border:1px solid #9caa7c77}
#menu .craft-selected-preview div{min-width:0}
#menu .craft-selected-preview b,#menu .craft-selected-preview small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#menu .craft-selected-preview small{font-size:10px;color:#d4c59c}
#menu .playtest-grant{width:auto;min-width:72px;min-height:30px;margin:0;padding:3px 6px;font-size:10px;white-space:nowrap;flex:none;background:#536d48;border-color:#aac07c;color:#f8f3d6}
#menu .menu-head .playtest-grant{margin-left:auto}
.item-drag-ghost{position:fixed;left:0;top:0;z-index:100;pointer-events:none;transform-origin:top left;margin:-22px 0 0 -25px;padding:8px;border:1px solid #e7d090;border-radius:6px;background:#243d30ed;color:#fff0cb;box-shadow:0 6px 20px #0009;font-size:12px;white-space:nowrap}
@media (hover:none) and (pointer:coarse) and (orientation:landscape){
  #world{touch-action:none}
  #stats{width:clamp(128px,18vw,150px);padding:5px 7px}
  #stats .stat{grid-template-columns:36px minmax(38px,1fr) 19px;gap:3px;margin:1px 0;font-size:9px;line-height:1.25}
  #stats .stat span::before{width:9px;height:9px}
  #stats .stat em{font-size:8px}
  #menu.inventory-panel,#menu.craft-panel{left:50%;top:calc((100% - max(0px,env(safe-area-inset-bottom)) - 54px)/2);width:min(530px,calc(100% - max(30px,env(safe-area-inset-left)) - max(30px,env(safe-area-inset-right))));height:min(236px,calc(100% - max(12px,env(safe-area-inset-top)) - max(85px,env(safe-area-inset-bottom))));min-height:0;padding:7px 9px;gap:4px}
  #menu.inventory-panel{width:min(430px,calc(100% - max(30px,env(safe-area-inset-left)) - max(30px,env(safe-area-inset-right))));height:min(202px,calc(100% - max(12px,env(safe-area-inset-top)) - max(85px,env(safe-area-inset-bottom))))}
  #menu .menu-head h2{font-size:14px}
  #menu .inventory-tabs button{min-height:27px;padding:3px 4px}
  #menu .inventory-grid{grid-auto-rows:43px;gap:3px}
  #menu .inventory-grid .inventory-cell{height:43px;padding:1px}
  #menu .item-icon{font-size:17px}
  #menu .item-icon .concept-art{width:23px;height:23px}
  #menu .item-name{font-size:9px}
  #menu .inventory-detail{min-height:29px;max-height:34px}
  #menu .craft-selected-preview{min-height:50px;gap:6px}
  #menu .concept-art.large{width:44px;height:44px}
  #menu .recipe-list{grid-template-columns:1fr;gap:3px}
  #menu .recipe{padding:3px 5px}
  #menu .craft-tabs button{min-height:25px;padding:2px 4px}
  #menu .craft-body{grid-template-columns:minmax(132px,39%) minmax(0,1fr);gap:6px}
  #menu .craft-body .recipe{height:35px}
  #menu .craft-body .recipe b{font-size:11px}
  #menu .craft-materials{grid-template-columns:1fr;gap:1px;padding:2px 1px}
  #menu .craft-material{font-size:10px;line-height:1.2}
  #menu .craft-footer small{font-size:10px}
  #hotbar{top:auto;bottom:max(6px,calc(env(safe-area-inset-bottom) + 4px));padding:3px 5px;gap:3px}
  #hotbar .slot{width:clamp(38px,9.8vh,49px);height:clamp(37px,9.5vh,47px);padding:2px 3px}
  #hotbar .slot .hotbar-icon{font-size:16px}
  #hotbar .slot b{font-size:8px}
  #touch-bag{bottom:max(53px,calc(env(safe-area-inset-bottom) + 49px));width:40px;height:40px;font-size:10px}
  #touch-craft{left:calc(max(7px,env(safe-area-inset-left)) + clamp(132px,32vh,156px));right:auto;top:auto;bottom:max(8px,calc(env(safe-area-inset-bottom) + 6px));width:40px;height:40px;font-size:10px}
  #action-buttons{grid-template-columns:repeat(2,clamp(45px,11.5vh,55px));grid-template-rows:repeat(2,clamp(43px,11vh,53px));gap:5px}
  #action-buttons .touch-action,#action-buttons .touch-action:nth-child(3){width:clamp(45px,11.5vh,55px);height:clamp(43px,11vh,53px);font-size:11px}
  #context-interact{right:calc(max(8px,env(safe-area-inset-right)) + 114px);bottom:max(12px,calc(env(safe-area-inset-bottom) + 9px));min-width:65px;max-width:100px;white-space:normal;font-size:9px}
  #quest-hud{max-height:28px!important;padding:3px 7px!important}
  #quest-hud small{display:none}
}
