/* ---------- Gifts (protocol 6): 🎁 in the backpack, only in a shared world with a friend within 8 blocks ----------
   Loaded before style.css, so rules on shared classes (.bag-tile, .btn) use two classes. */
.inventory-panel .bag-head .bag-gift { min-width:52px; min-height:44px; font-size:22px; line-height:1; background:linear-gradient(#ffd66b,#f2a93b); border-color:#fff3c4; color:#4a2a00; }
.inventory-panel .bag-head .bag-gift.on { background:linear-gradient(#fff1a8,#ffc24d); box-shadow:0 0 0 3px #ffe58a, 0 0 16px #ffd34d; animation:giftOn 1.1s ease-in-out infinite; }
.inventory-panel .bag-head .bag-gift.busy { animation:giftBusy .6s ease-in-out infinite alternate; }
@keyframes giftOn { 50% { box-shadow:0 0 0 5px #ffe58a99, 0 0 22px #ffd34d; } }
@keyframes giftBusy { to { transform:translateY(-3px) rotate(-6deg); } }

/* While 🎁 is on: a little 🎁 on everything that can be given, 🚫 on tools, armour and equipment. */
.backpack-panel.gifting .bag-items .bag-tile { border-color:#ffe08a88; }
.backpack-panel .bag-tile .gift-mark { position:absolute; top:2px; right:3px; font-style:normal; font-size:15px; line-height:1; filter:drop-shadow(0 1px 1px #000a); pointer-events:none; }
.backpack-panel .bag-items .bag-tile.gift-no { border-color:#ffffff1a; filter:grayscale(.7); opacity:.6; }
.backpack-panel .bag-items .bag-tile.gift-no .gift-mark { font-size:20px; top:1px; right:2px; }
.backpack-panel .bag-items .bag-tile.gift-wait { border-color:#ffe27a; box-shadow:0 0 0 3px #ffe27a80, inset 0 0 12px #ffd34d70; animation:giftWait .5s ease-in-out infinite alternate; }
@keyframes giftWait { to { transform:scale(1.06); } }
.backpack-panel .bag-items .bag-tile.nope { animation:cardNope .35s; }
/* Waiting for the room's answer (at most 5 s): taps wait too, and so does ✕, so the item can't be used up (placed,
   eaten, crafted) between giving it and the room's answer. The answer closes the backpack by itself. The #ui prefix
   outranks style.css's `#ui button { pointer-events:auto }`, which a parent's pointer-events:none can't. */
#ui .backpack-panel.gift-busy .bag-main, #ui .backpack-panel.gift-busy .bag-main button, #ui .backpack-panel.gift-busy .bag-head .bag-close { pointer-events:none; }
.backpack-panel.gift-busy .bag-head .bag-close { opacity:.55; }

/* Phones: the same size as the backpack's ✕ beside it. */
@media (max-width:360px) {
  .inventory-panel .bag-head .bag-gift { min-width:44px; padding:6px 8px; }
}
@media (max-height:600px) and (orientation:landscape) {
  .inventory-panel .bag-head .bag-gift { min-height:38px; padding:4px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .inventory-panel .bag-head .bag-gift.on, .inventory-panel .bag-head .bag-gift.busy, .backpack-panel .bag-items .bag-tile.gift-wait { animation:none; }
}
