/* One small tag follows the selected object. It never blocks the stage. */
.item-art{display:block;width:100%;height:100%;aspect-ratio:1;background-image:var(--item-sheet);background-size:400% 400%;background-position:var(--item-x) var(--item-y);background-repeat:no-repeat;pointer-events:none}
/* Every painted sprite shares the same matte cleanup, including variants and
   drag previews. The atlas contains low-alpha rectangular background residue. */
.item-art[data-art]{--item-cutout:url(#inventory-alpha-cutout);filter:var(--item-cutout)}
/* Drawn objects use the same full-size square as painted atlas objects. */
#pockets .pocket>.finale-item-art,#held-picture>.finale-item-art{width:100%;height:100%;max-height:none}
#held-item{position:absolute;bottom:65px;left:0;right:0;display:flex;align-items:center;gap:8px;min-height:48px;padding:4px 5px 4px 11px;border:1px solid #c9b68a99;border-radius:10px 18px 18px 10px;background:linear-gradient(115deg,#faf1dce8,#f1e5cbd9);box-shadow:0 3px 18px #30463422;backdrop-filter:blur(8px);pointer-events:auto;color:#4f583f}
#held-picture{display:grid;place-items:center;flex:0 0 28px}#held-picture svg{width:27px;height:29px}
.held-copy{flex:1;min-width:0}#held-name{display:block;font:13px/1.3 Georgia,serif}#held-condition{display:block;font:10px/1.35 Arial,sans-serif;color:#7d7960;margin-top:3px}
#held-item button{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;border:0;background:#fff8e05c;border-radius:50%;color:#6d795c}#held-item button:hover{background:#e3d9b7}#held-item button svg{width:20px;height:20px}
#held-item[data-notice=true]{min-height:44px;background:linear-gradient(110deg,#fcf1cf,#e7ead1);animation:bag-note .3s ease-out}#held-item[data-notice=true] #held-name{font-size:12px}
#app.has-held-ribbon #toast,#app.has-held-ribbon #actions{bottom:max(145px,calc(env(safe-area-inset-bottom) + 129px))}
.pocket[data-condition=dirty]{color:#938572}.pocket[data-condition=clean]{color:#8d793e;background:#fff4ccbb}.pocket.item-changed{animation:bag-glimmer .8s ease-out 2}
#toast[data-kind=thought] #toast-speaker{font-size:15px}#toast[data-kind=thought] #toast-text{font-style:italic}.inventory-observation{display:block;font:11px/1.5 Arial,sans-serif;color:#81755b;margin-bottom:7px}
@keyframes bag-note{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}@keyframes bag-glimmer{50%{box-shadow:0 0 0 4px #ffe7a666,0 0 22px #fff1bd;filter:brightness(1.15)}}
@media(max-width:350px){#held-name{font-size:12px}#held-item{gap:5px;padding-left:8px}.held-copy{max-width:none}}
@media(prefers-reduced-motion:reduce){#held-item,.pocket.item-changed{animation:none}}

#pockets .pocket{touch-action:none;user-select:none;-webkit-user-select:none;flex-shrink:0}#pockets{pointer-events:auto;touch-action:pan-x}#pockets .drag-source{opacity:.4}#pockets .combine-target{background:#fff0bd;box-shadow:inset 0 0 0 2px #ac7e3c,0 0 18px #ffe6a0;transform:translateY(-2px)}
#inventory-drag{position:absolute;z-index:30;pointer-events:none;display:flex;align-items:center;gap:8px;max-width:calc(100% - 20px);padding:10px 14px;border:1px solid #ead5a8;border-radius:16px;background:#fff3daee;box-shadow:0 8px 24px #26392c40;color:#5c6247;font:13px/1.3 Georgia,serif}#inventory-drag svg{width:28px;height:28px;flex-shrink:0}#inventory-drag[data-over=true]{background:#fff0ba;border-color:#af873e}.inventory-dragging #pockets{scroll-behavior:auto}.inventory-dragging{cursor:grabbing}#combine-item[aria-pressed=true]{background:#ead29b}#held-item #separate-item{flex-basis:38px;width:38px}#held-item:has(#separate-item:not([hidden])){gap:4px}#held-item:has(#separate-item:not([hidden])) #held-picture{display:none}

/* Four quick pockets, plus a real, reversible backpack drawer. */
footer{gap:8px}#pockets{flex:1;gap:6px;overflow:hidden;padding:4px 0}#pockets .pocket{flex:1 1 0;min-width:28px;max-width:44px;width:40px}.atlas-button,#backpack{flex-shrink:0}#backpack{position:relative;width:44px;height:44px;background:#e6dcc1e8;pointer-events:auto}#backpack-count{position:absolute;right:-2px;top:-4px;min-width:18px;height:18px;padding:1px 4px;border-radius:50%;background:#758467;color:#fff5db;font:11px/16px Georgia,serif}footer .save-state:empty{display:none}
#backpack-dialog{position:fixed;inset:auto 0 max(18px,env(safe-area-inset-bottom));margin:0 auto;width:min(420px,calc(100% - 28px));max-height:72dvh;padding:28px 22px 16px;border:2px solid #d3bd8d;background:radial-gradient(ellipse at top left,#fff5dc,#eee3c7);box-shadow:inset 0 0 0 5px #faf2df99,0 18px 70px #283d3566}#backpack-dialog h2{margin:7px 0}#backpack-dialog h3{font:italic 17px Georgia,serif;border-bottom:1px solid #b8a67466;padding-bottom:7px;margin:22px 0 8px}#backpack-dialog>p:not(.eyebrow){font:13px/1.5 Georgia,serif;color:#7b785d}#backpack-dialog .eyebrow{font-size:8px;letter-spacing:1.4px;padding-right:20px}.bag-item{display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:10px;align-items:center;min-height:54px;padding:5px 0;border-bottom:1px dashed #b7a57b55}.bag-item>svg{width:27px;height:30px}.bag-item>span{font:14px/1.3 Georgia,serif}.bag-item button{min-height:44px;padding:8px 12px;border:1px solid #b7ae8b;border-radius:13px;background:#e1e4cc;font:13px Georgia,serif}#bag-empty{font-style:italic}#pack-everything{width:100%;padding-bottom:5px}#pack-everything:disabled{opacity:.4;cursor:default}

/* Painted travel kit: generous targets, four quick pockets and two visible compartments. */
footer::before{content:'';position:absolute;inset:-9px -15px -12px;z-index:-1;pointer-events:none;background:radial-gradient(ellipse at 50% 62%,#f8e9bca8 0%,#e3dbb06b 50%,#d5d2a52e 65%,transparent 76%);filter:blur(4px)}
#pockets{overflow:visible;padding:5px 0 3px}
#pockets .pocket{position:relative;max-width:55px;min-width:36px;height:52px;padding:3px;border:0;border-radius:50%;background:transparent;box-shadow:none;transition:transform .22s,filter .22s}
#pockets .pocket .item-art{filter:var(--item-cutout,opacity(1)) drop-shadow(0 4px 2px #35402b60);transition:filter .22s}
#pockets .pocket[aria-pressed=true]{background:radial-gradient(ellipse,#fff0ad99,transparent 72%);box-shadow:none;transform:translateY(-5px) scale(1.1)}
#pockets .pocket[aria-pressed=true] .item-art{filter:var(--item-cutout,opacity(1)) drop-shadow(0 0 4px #ffe5a2) drop-shadow(0 5px 2px #35402b66)}
#pockets .pocket:hover{transform:translateY(-3px)}
#backpack,#atlas{width:52px;height:56px;padding:2px;border:0;border-radius:12px;background:transparent;box-shadow:none}#backpack .item-art,#atlas .item-art{filter:var(--item-cutout,opacity(1)) drop-shadow(0 3px 2px #20372a55)}
#held-picture{flex-basis:38px;height:38px}#held-item{bottom:69px}#inventory-drag>.item-art{width:46px;height:46px;flex:0 0 46px}
.combine-compatible::after{content:'✧';position:absolute;right:1px;top:-5px;color:#fff2b9;background:#93763ed9;border:1px solid #eacf88;border-radius:50%;width:19px;height:19px;text-align:center;font:19px/18px Georgia;box-shadow:0 0 7px #ffe1a5;pointer-events:none}
#pockets .combine-compatible{outline:1px solid #e8cc80;outline-offset:1px}
#backpack-dialog{inset:0;margin:auto;width:min(530px,calc(100vw - 16px),calc((100dvh - 16px)*.667));height:auto;aspect-ratio:2/3;max-height:calc(100dvh - 16px);padding:0;border:1px solid #a48b56;border-radius:22px;background:#ba9b67 url('./assets/inventory/backpack-115.webp') center/100% 100%;overflow:hidden;box-shadow:0 20px 90px #10291ed9;color:#493b29}
#backpack-dialog::backdrop{background:#142d25b8;backdrop-filter:blur(5px)}
#backpack-dialog::after{content:'';position:absolute;inset:0;pointer-events:none;background:inherit;clip-path:polygon(0 79%,12% 79%,22% 82%,40% 83.5%,60% 83.5%,78% 82%,88% 79%,100% 79%,100% 100%,0 100%);z-index:2}
#backpack-dialog .close{top:2.5%;right:3%;width:44px;height:44px;background:#fff0cbe8;color:#526448;border:1px solid #baa269;z-index:3}
#backpack-dialog #backpack-title{position:absolute;top:8.3%;left:25%;width:50%;margin:0;text-align:center;color:#e5d4a1;text-shadow:0 1px #273c26,0 -1px #b6b28888;font:italic clamp(17px,4.2vw,25px)/1.13 Georgia,serif;letter-spacing:.2px}
#backpack-dialog #bag-help{position:absolute;top:23.1%;left:16%;width:68%;margin:0;text-align:center;font:clamp(10px,2.4vw,12px)/1.3 Georgia,serif;color:#4b3e2b}
#backpack-dialog .bag-compartment{position:absolute;left:13%;width:74%;box-sizing:border-box;border:1px solid transparent;border-radius:15px;transition:background .15s,box-shadow .15s}
#backpack-dialog .bag-main{top:31%;height:33.5%;display:flex;flex-direction:column}#backpack-dialog .bag-front{top:69.2%;height:13.8%}
#backpack-dialog h3{position:relative;flex:none;margin:0 4px 8px;padding:0 0 4px;border:0;text-align:center;font:italic clamp(13px,3vw,18px)/1.15 Georgia,serif;color:#715638;text-shadow:0 1px #dfbd81,0 -1px #48382155}#bag-ready-count{position:absolute;right:0;bottom:3px;font:10px/1.5 Georgia;opacity:.7}
#bag-stored{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#9b784c transparent;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:max-content;align-content:start;gap:9px 7px;padding:7px 5px}
#bag-ready{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;padding:0 4px}
#backpack-dialog .bag-item{position:relative;display:flex;flex-direction:column;align-items:center;gap:1px;min-width:0;min-height:44px;width:100%;padding:3px;border:0;border-radius:50%;background:transparent;color:#493d2d;touch-action:none;user-select:none;cursor:grab}
#backpack-dialog .bag-item:hover,#backpack-dialog .bag-item:focus-visible{background:#fcebc65c;outline:1px dashed #947548;outline-offset:0}
#backpack-dialog .bag-item>.item-art{width:100%;height:auto;flex:0 0 auto;aspect-ratio:1;transform:translateY(var(--nest-y,0px)) rotate(var(--tumble,0deg));filter:var(--item-cutout,opacity(1)) drop-shadow(1px 3px 2px #5e452b55)}#backpack-dialog .bag-item>svg:not(.item-art){width:40px;height:40px}
#backpack-dialog .bag-item-name{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#backpack-dialog .bag-front .bag-item-name{display:none}#backpack-dialog .bag-front .bag-item{padding:0;height:clamp(43px,14vw,74px)}#backpack-dialog .bag-front .item-art{width:auto;height:100%}
#backpack-dialog #bag-empty{position:absolute;left:5%;right:5%;top:36%;margin:0;text-align:center;font:italic 14px/1.5 Georgia;color:#6b5439}
#backpack-dialog #pack-everything{position:absolute;left:28%;bottom:5.4%;width:44%;min-height:44px;padding:7px 10px;border:1px dashed #c7b88a88;border-radius:8px;background:#394e393b;color:#f0e2b8;font:italic 14px/1.2 Georgia;text-shadow:0 1px #2f3826;box-shadow:none;z-index:3}
#backpack-dialog .drop-ready{background:#f9e8b35c;box-shadow:inset 0 0 0 2px #e1bd6f,0 0 18px #fff0b877}#backpack-dialog .drag-source{opacity:.35}
.bag-drag-ghost{position:fixed;width:68px;height:68px;pointer-events:none;z-index:10;filter:drop-shadow(0 5px 4px #40302077)}
#backpack-dialog .bag-name-preview{position:absolute;z-index:4;top:16.5%;left:12%;width:76%;box-sizing:border-box;padding:7px 14px;border:1px dashed #a38655;border-radius:9px;background:#f3e4c6f5;color:#3c432f;box-shadow:0 3px 9px #3a241c24;text-align:center;font:600 clamp(14px,3.8vw,20px)/1.25 Georgia,serif;overflow-wrap:anywhere;pointer-events:none}
#backpack-dialog .bag-name-preview[hidden]{display:none}
#held-item #combine-item svg,#held-item #separate-item svg{width:25px;height:25px;stroke-width:1.4}
@media(max-height:500px){#backpack-dialog{width:min(440px,calc(100vw - 16px));height:calc(100dvh - 16px);aspect-ratio:auto;background-size:100% 100%}#backpack-dialog .bag-item-name{display:none}#backpack-dialog .bag-main{top:32%;height:32%}#backpack-dialog #bag-help{font-size:10px}#backpack-dialog #backpack-title{font-size:19px}#backpack-dialog .bag-item>.item-art{max-height:45px;width:45px}#backpack-dialog .bag-front .bag-item{height:42px}#backpack-dialog #pack-everything{bottom:1.7%;min-height:35px}}

/* The selected object is a small paper card, not a full-width desktop bar. */
#held-item{right:auto;width:max-content;max-width:100%;box-sizing:border-box}
#held-item .held-copy{flex:1 1 auto;min-width:140px;max-width:260px;overflow-wrap:break-word}
@media(min-width:600px){#held-item{max-width:min(520px,calc(100% - 128px))}}
@media(max-width:599px){
 /* Give the name its own row. Action targets must never squeeze it into
    a column of individual letters, even with the fourth (separate) action. */
 #held-item{display:grid;grid-template-columns:38px minmax(0,1fr) repeat(3,44px);gap:5px 8px;width:min(340px,100%);padding:9px 11px}
 #held-item #held-picture{display:grid;grid-column:1;grid-row:1;width:38px}
 #held-item .held-copy{grid-column:2/-1;grid-row:1;min-width:0;max-width:none}
 #held-item button{grid-row:2;justify-self:end}
 #held-item #inspect-item{grid-column:-4}
 #held-item #combine-item{grid-column:-3}
 #held-item #put-away-item{grid-column:-2}
 #held-item:has(#separate-item:not([hidden])){grid-template-columns:38px minmax(0,1fr) repeat(4,44px);gap:5px 6px}
 #held-item:has(#separate-item:not([hidden])) #held-picture{display:grid}
 #held-item:has(#separate-item:not([hidden])) #inspect-item{grid-column:-5}
 #held-item:has(#separate-item:not([hidden])) #combine-item{grid-column:-4}
 #held-item #separate-item{grid-column:-3;width:44px}
 #app.has-held-ribbon :is(.nori-card,.party-card){bottom:calc(max(24px,env(safe-area-inset-bottom)) + 79px + var(--held-ribbon-height,60px))}
 #app.has-held-ribbon #toast.show[data-kind],#app.has-held-ribbon #actions:not([hidden]){bottom:calc(max(24px,env(safe-area-inset-bottom)) + 143px + var(--held-ribbon-height,60px))}
}
