/* Compact inventory surface, with the established game colors and item art. */
#game-shell #drawer:has(.bag-layout){width:min(720px,calc(100% - 48px));max-height:min(680px,calc(100dvh - 150px));padding:18px;border-radius:14px}
#game-shell #drawer:has(.bag-layout)>h2{font-size:21px;margin:8px 0 12px}
#game-shell .bag-summary{gap:6px}
#game-shell .bag-summary span{padding:7px;font-size:12px;gap:4px}
#game-shell .bag-layout{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:8px;margin-top:12px}
#game-shell .bag-layout h3{font-size:13px;padding-bottom:8px}
#game-shell .bag-slots{height:250px;max-height:32dvh;gap:6px;grid-template-columns:repeat(auto-fill,minmax(48px,1fr))}
#game-shell .bag-selected-body{height:250px;max-height:32dvh;overflow:auto}
#game-shell .bag-select-hint{min-height:160px;font-size:12px}
#game-shell .bag-gear,#game-shell .bag-more{margin-top:10px}
#game-shell .bag-selected-body .inventory-item{padding:9px;min-height:0}
@media(max-width:760px){
 #game-shell #drawer:has(.bag-layout){width:calc(100% - 16px);left:8px;right:8px;padding:12px;max-height:calc(100dvh - 140px)}
 #game-shell .bag-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
 #game-shell .bag-layout{grid-template-columns:minmax(0,1fr)}
 #game-shell .bag-slots{height:170px;max-height:25dvh;grid-template-columns:repeat(auto-fill,minmax(45px,1fr))}
 #game-shell .bag-selected-body{height:auto;max-height:250px}
}
/* Denser inventory content, wider centered desktop panel. */
#game-shell #drawer:has(.bag-layout){padding:12px;max-height:calc(100dvh - 110px)}
#game-shell #drawer:has(.bag-layout) .bag-summary{margin-bottom:8px;gap:5px}
#game-shell #drawer:has(.bag-layout) .bag-summary span{padding:5px 7px;font-size:12px;line-height:1.4}
#game-shell #drawer:has(.bag-layout) .bag-layout{gap:8px;margin-top:6px}
#game-shell #drawer:has(.bag-layout) :is(.bag-contents,.bag-selected){padding:8px}
#game-shell #drawer:has(.bag-layout) .bag-layout h3{font-size:13px;margin-bottom:6px;padding-bottom:5px}
#game-shell #drawer:has(.bag-layout) .bag-slots{grid-template-columns:repeat(auto-fill,48px);gap:5px;height:clamp(200px,34dvh,340px);max-height:34dvh}
#game-shell #drawer:has(.bag-layout) .bag-slot{width:48px;min-height:48px;height:48px;padding:3px}
#game-shell #drawer:has(.bag-layout) .bag-slot .item-image{max-width:40px;max-height:40px}
#game-shell #drawer:has(.bag-layout) .bag-selected-body{height:clamp(200px,34dvh,340px);max-height:34dvh}
#game-shell #drawer:has(.bag-layout) .bag-selected-body :is(p,small,li,label){font-size:12px;line-height:1.45}
#game-shell #drawer:has(.bag-layout) .bag-selected-body .inventory-item{padding:7px}
#game-shell #drawer:has(.bag-layout) .bag-select-hint{min-height:110px;padding:10px;font-size:12px}
#game-shell #drawer:has(.bag-layout) :is(.bag-gear,.bag-more)>summary{padding:7px 10px;font-size:12px;min-height:36px}
@media(min-width:761px){#game-shell #drawer:has(.bag-layout){inset:50% auto auto 50%!important;transform:translate(-50%,-50%);width:min(1200px,calc(100vw - 40px))!important;max-width:1200px;height:auto!important}#game-shell #drawer:has(.bag-layout) .bag-layout{grid-template-columns:minmax(0,1.4fr) minmax(280px,1fr)}}
@media(max-width:760px){#game-shell #drawer:has(.bag-layout) .bag-selected-body{height:auto;max-height:260px}#game-shell #drawer:has(.bag-layout) .bag-slots{height:200px;max-height:30dvh}#game-shell #drawer:has(.bag-layout) .bag-selected-body button{min-height:44px}}
/* Denser inventory content, wider centered desktop panel. */
#game-shell #drawer:has(.bag-layout){padding:12px;max-height:calc(100dvh - 110px)}
#game-shell #drawer:has(.bag-layout) .bag-summary{margin-bottom:8px;gap:5px}
#game-shell #drawer:has(.bag-layout) .bag-summary span{padding:5px 7px;font-size:12px;line-height:1.4}
#game-shell #drawer:has(.bag-layout) .bag-layout{gap:8px;margin-top:6px}
#game-shell #drawer:has(.bag-layout) :is(.bag-contents,.bag-selected){padding:8px}
#game-shell #drawer:has(.bag-layout) .bag-layout h3{font-size:13px;margin-bottom:6px;padding-bottom:5px}
#game-shell #drawer:has(.bag-layout) .bag-slots{grid-template-columns:repeat(auto-fill,48px);gap:5px;height:clamp(200px,34dvh,340px);max-height:34dvh}
#game-shell #drawer:has(.bag-layout) .bag-slot{width:48px;min-height:48px;height:48px;padding:3px}
#game-shell #drawer:has(.bag-layout) .bag-slot .item-image{max-width:40px;max-height:40px}
#game-shell #drawer:has(.bag-layout) .bag-selected-body{height:clamp(200px,34dvh,340px);max-height:34dvh}
#game-shell #drawer:has(.bag-layout) .bag-selected-body :is(p,small,li,label){font-size:12px;line-height:1.45}
#game-shell #drawer:has(.bag-layout) .bag-selected-body .inventory-item{padding:7px}
#game-shell #drawer:has(.bag-layout) .bag-select-hint{min-height:110px;padding:10px;font-size:12px}
#game-shell #drawer:has(.bag-layout) :is(.bag-gear,.bag-more)>summary{padding:7px 10px;font-size:12px;min-height:36px}
@media(min-width:761px){#game-shell #drawer:has(.bag-layout){inset:50% auto auto 50%!important;transform:translate(-50%,-50%);width:min(1200px,calc(100vw - 40px))!important;max-width:1200px;height:auto!important}#game-shell #drawer:has(.bag-layout) .bag-layout{grid-template-columns:minmax(0,1.4fr) minmax(280px,1fr)}}
@media(max-width:760px){#game-shell #drawer:has(.bag-layout) .bag-selected-body{height:auto;max-height:260px}#game-shell #drawer:has(.bag-layout) .bag-slots{height:200px;max-height:30dvh}#game-shell #drawer:has(.bag-layout) .bag-selected-body button{min-height:44px}}
/* Keep the bag between the header and combat menu, inside the game shell. */
#game-shell #drawer:has(.bag-layout){
 --bag-top:90px;
 --bag-bottom:calc(var(--combat-hud-bottom,24px) + var(--combat-hud-height,150px) + 12px);
 inset:var(--bag-top) auto auto 50%!important;
 transform:translateX(-50%);
 margin:0;
 height:auto!important;
 max-height:calc(100% - var(--bag-top) - var(--bag-bottom));
 overflow-y:auto;
 overscroll-behavior:contain;
}
@media(min-width:761px){
 #game-shell #drawer:has(.bag-layout){left:calc(50% + 32px)!important;width:min(1200px,calc(100% - 96px))!important;max-width:1200px}
}
@media(max-width:760px){
 #game-shell #drawer:has(.bag-layout){--bag-top:120px;width:calc(100% - 16px)!important;max-width:none}
}
@media(pointer:coarse),(any-pointer:coarse){
 #game-shell.touch-playing #drawer:has(.bag-layout){--bag-top:66px}
}
/* Multi-slot lock editing: checkmarks reflect the saved lock or its pending edit. */
#game-shell .bag-board-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}
#game-shell #drawer #drawer-content .bag-board-actions button,#game-shell #drawer #drawer-content .bag-lock-toolbar button{min-height:44px;padding:7px 10px;font-size:12px}
#game-shell .bag-lock-toolbar{padding:10px;margin-bottom:10px;border:1px solid #c8b77a;border-radius:9px;background:#293d2c}
#game-shell .bag-lock-toolbar[hidden],#game-shell [data-bag-lock-toggle][hidden]{display:none!important}
#game-shell .bag-lock-toolbar p{margin:0 0 8px;color:#f0dfae;font-size:12px}
#game-shell .bag-lock-toolbar>div{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:6px}
#game-shell [data-bag-lock-save]{background:#566442;color:#fff0c6;border-color:#d6bf7c}
#game-shell .bag-lock-check{display:none}
#game-shell [data-bag-lock-mode] .bag-lock-check{display:grid;place-items:center;position:absolute;right:3px;top:3px;z-index:3;width:19px;height:19px;border:2px solid #e9d7a2;border-radius:50%;background:#10251f;color:#fff7df;font-size:15px;font-weight:bold;line-height:1;box-shadow:0 1px 3px #0008}
#game-shell [data-bag-lock-mode] .bag-slot[aria-pressed=true] .bag-lock-check,#game-shell [data-bag-lock-mode] .bag-slot[aria-pressed=mixed] .bag-lock-check{background:#7d632c}
#game-shell [data-bag-lock-mode] .bag-slot:disabled{opacity:.7;cursor:wait}
#game-shell [data-bag-lock-mode] .bag-slot-lock{display:none}
#game-shell [data-bag-lock-mode]>.bag-summary,#game-shell [data-bag-lock-mode]>.eyebrow,#game-shell [data-bag-lock-mode]>.bag-gear,#game-shell [data-bag-lock-mode]>.bag-more,#game-shell [data-bag-lock-mode] .bag-stack-help,#game-shell [data-bag-lock-mode] .bag-board-actions{display:none}
#game-shell .bag-lock-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px;position:sticky;top:0;z-index:4}
#game-shell #drawer #drawer-content .bag-lock-toolbar p{margin:0;font-size:12px;line-height:1.5;flex:1;min-width:75px}
#game-shell #drawer #drawer-content[data-bag-lock-mode]>h2{font-size:20px;margin:0 0 6px}
#game-shell #drawer #drawer-content[data-bag-lock-mode] .bag-contents{padding:8px}
#game-shell #drawer #drawer-content[data-bag-lock-mode] .bag-lock-toolbar{padding:8px}
