/* ---------------------------------------------------------------- Bag (js/bag.js)
   One scroll area (the panel body). Sticky pockets + search on top, the items as a list below.
   The item card: a side panel on wide screens, a bottom sheet over the list on phones / short landscape. */
.modal.bag-panel { position: relative; }   /* the phone card + scrim are placed against the sheet, not the scroller */
.bag-panel .mh-actions { margin-left: auto; }
html .modal.bag-panel .modal-body { padding: 0 16px 16px; }
.bag { --bg-top: #142048; min-width: 0; }

/* ---- sticky top: pockets, then search + sort */
.bg-top { position: sticky; top: 0; z-index: 3; margin: 0 -16px; padding: 12px 16px 10px; background: var(--bg-top); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.bg-pockets { display: flex; gap: 6px; flex-wrap: nowrap; }
.bg-pk { display: inline-flex; flex: 1 1 auto; justify-content: center; align-items: center; gap: 7px; min-width: 0; min-height: 38px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font: 800 13px/1 Nunito, sans-serif; transition: background var(--t), color var(--t), border-color var(--t); }
.bg-pk:hover:not(:disabled) { color: #fff; background: var(--surface-2); }
.bg-pk:disabled { opacity: .35; cursor: default; }
.bg-pk.on { color: #fff; border-color: var(--gold); background: rgba(255, 207, 74, .12); }
.bg-pk.on .ic { color: var(--gold); }
.bg-pk-top { display: inline-flex; align-items: center; gap: 7px; order: 0; }
.bg-pk-top em { order: 2; font-style: normal; font-size: 11px; font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.bg-pk.on .bg-pk-top em { color: var(--gold); }
.bg-pk .ic { width: 17px; height: 17px; flex: none; }
.bg-pk-l { order: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* a longer translated pocket name ends in … instead of spilling out of its tile */
.bg-pk-top { display: contents; }
.bg-pk-top .ic { order: 0; }
.bg-pk .long { display: none; }   /* short names everywhere (the full name is the tooltip): one row, no wrapping */
.bg-pockets.searching .bg-pk { opacity: .6; }
.bg-pockets.searching .bg-pk:disabled { opacity: .3; }

.bg-tools { display: flex; gap: 8px; }
.bg-search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .25); }
.bg-search:focus-within { border-color: var(--gold); }
.bg-search > .ic { width: 17px; height: 17px; color: var(--muted); flex: none; }
.bg-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: #fff; font: 700 14px Nunito, sans-serif; outline: none; text-overflow: ellipsis; }
.bg-search input::placeholder { color: var(--muted); opacity: .85; }
.bg-search input::-webkit-search-cancel-button { display: none; }
.bg-clear { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--muted); padding: 0; }
.bg-clear[hidden] { display: none; }
.bg-clear:hover { color: #fff; background: var(--surface-2); }
.bg-clear .ic { width: 16px; height: 16px; }
.bg-sort { position: relative; flex: none; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 8px 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.bg-sort .ic { width: 16px; height: 16px; flex: none; }
.bg-sort select { appearance: none; -webkit-appearance: none; border: 0; background: none; color: #fff; font: 800 13px Nunito, sans-serif; padding: 0 2px; cursor: pointer; outline: none; }
.bg-sort select option { background: #16234a; }

/* ---- the list */
.bg-list { padding-top: 12px; display: grid; gap: 14px; }
.bg-sec h5 { display: flex; align-items: center; gap: 6px; margin: 0 2px 6px; font-size: 11px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.bg-sec h5 .ic { width: 14px; height: 14px; }
.bg-sec h5 em { font-style: normal; letter-spacing: 0; font-size: 11px; color: var(--muted); opacity: .8; }
.bg-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.bg-row { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 52px; padding: 6px 12px 6px 8px; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface); color: inherit; text-align: left; transition: background var(--t), border-color var(--t); }
.bg-row:hover { background: var(--surface-2); }
.bg-row.sel { border-color: var(--gold); background: rgba(255, 207, 74, .08); }
/* Boosts from the Mall (js/cosmetics.js bagBoostsHtml): lures held / running and the Pocket Healer, used in place */
.bg-boost { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 52px; padding: 6px 8px; border-radius: 12px; background: rgba(178, 124, 255, .08); border: 1px solid rgba(178, 124, 255, .25); }
.bg-boost.on { background: linear-gradient(120deg, rgba(142, 68, 201, .3), rgba(142, 68, 201, .08)); border-color: rgba(208, 140, 255, .5); }
.bg-boost > img { width: 38px; height: 38px; flex: none; }
.bg-boost .bg-txt b em { font-style: normal; color: var(--muted); font-weight: 800; }
.bg-boost .bg-txt small { white-space: normal; }
.bg-boost .bg-txt i { font-style: normal; color: var(--gold); font-weight: 900; }
.bg-boost .btn { flex: none; min-width: 72px; }
.bg-boosts h5 .bg-mall { margin-left: auto; border: 0; background: none; color: var(--accent-2); font: 900 11px Nunito, sans-serif; letter-spacing: .3px; text-transform: none; cursor: pointer; padding: 4px 2px; }
.bg-row .item-art.sm { width: 38px; height: 38px; }
.bg-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.bg-txt b { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: #eef2ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-txt small { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-new { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(255, 207, 74, .18); }
.bg-meta { flex: none; display: flex; align-items: center; gap: 6px; }
.bg-tag { display: inline-flex; color: var(--muted); }
.bg-tag .ic { width: 14px; height: 14px; }
.bg-n { min-width: 34px; text-align: right; font: 900 13px/1 Nunito, sans-serif; color: var(--gold); font-variant-numeric: tabular-nums; }
.bg-empty { display: grid; justify-items: center; gap: 6px; padding: 48px 16px; text-align: center; color: var(--muted); }
.bg-empty .ic { width: 30px; height: 30px; opacity: .7; }
.bg-empty b { color: #e4eaff; font-size: 15px; }
.bg-empty small { font-size: 12.5px; font-weight: 700; }

/* ---- the item card (shared look) */
.bg-card { display: flex; flex-direction: column; border-radius: 18px; border: 1px solid var(--line-2); background: #17244d; }
.bg-grip { display: none; }
.bg-head { display: flex; align-items: center; gap: 12px; padding: 14px 10px 10px 14px; }
.bg-head .item-art.lg { width: 52px; height: 52px; }
.bg-head-t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.bg-head-t b { font-size: 17px; font-weight: 900; line-height: 1.2; }
.bg-head-t small { font-size: 12px; font-weight: 700; color: var(--muted); }
.bg-x { width: 40px; height: 40px; flex: none; display: none; place-items: center; border-radius: 12px; border: 0; background: var(--surface); color: var(--muted); padding: 0; }
.bg-x .ic { width: 18px; height: 18px; }
.bg-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.bg-desc { margin: 0; font-size: 13.5px; line-height: 1.45; color: #dde5ff; }
.bg-bound { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--muted); }
.bg-bound .ic { width: 14px; height: 14px; }
.bg-main { width: 100%; min-height: 48px; font-size: 15px; justify-content: center; }
.bg-main.primary:disabled { opacity: 1; background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.bg-note { font-size: 12px; font-weight: 700; color: var(--muted); }
.bg-more { display: flex; gap: 6px; flex-wrap: wrap; }
.bg-more:empty { display: none; }
.bg-more .btn { flex: 1 1 0; justify-content: center; min-height: 40px; }
.bg-more .btn.pinned { color: var(--gold); }
.bg-tossb:hover:not(:disabled) { color: #ffb3b9; }
.bg-lbl { margin: 0; font-size: 11px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.bg-back { align-self: flex-start; min-height: 40px; }
.bg-mons { display: grid; gap: 6px; }
.bg-mon { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 12px 6px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: inherit; text-align: left; }
.bg-mon:hover:not(:disabled) { border-color: var(--gold); }
.bg-mon:disabled { opacity: .5; cursor: default; }
.bg-mpic { width: 42px; height: 42px; flex: none; border-radius: 10px; overflow: hidden; }
.bg-mpic img { width: 100%; height: 100%; object-fit: contain; }
.bg-mon-t { flex: 1; min-width: 0; display: grid; gap: 3px; }
.bg-mon-t b { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-mon-t b em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 4px; }
.bg-mon-t small { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-hp { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.bg-hp i { display: block; height: 100%; background: #3cc17a; transition: width .3s var(--ease); }
.bg-hp i.mid { background: #f0c03a; }
.bg-hp i.low { background: #ff5f6b; }
.bg-slots { display: flex; gap: 8px; }
.bg-slot { position: relative; flex: 1 1 0; max-width: 60px; aspect-ratio: 1; min-height: 44px; border-radius: 12px; border: 1px dashed var(--line-2); background: rgba(0, 0, 0, .25); display: grid; place-items: center; padding: 0; color: inherit; }
.bg-slot > span { position: absolute; top: 3px; left: 6px; font-size: 11px; font-weight: 900; color: var(--muted); }
.bg-slot .item-art, .bg-slot .ic { width: 26px; height: 26px; }
.bg-slot.on { border: 1px solid var(--gold); background: rgba(255, 207, 74, .14); }
.bg-slot.on > span { color: var(--gold); }
.bg-toss { display: flex; align-items: center; gap: 8px; }
.bg-toss-n { min-width: 36px; text-align: center; font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.bg-toss .bg-all { margin-left: auto; }
.bg-row2 { display: flex; gap: 8px; }
.bg-row2 .btn { flex: 1; justify-content: center; min-height: 44px; }
.bg-hint { display: grid; justify-items: center; gap: 6px; padding: 40px 18px; text-align: center; color: var(--muted); }
.bg-hint .ic { width: 28px; height: 28px; opacity: .6; }
.bg-hint b { color: #e4eaff; font-size: 14px; }
.bg-hint small { font-size: 12.5px; font-weight: 700; }
.bg-scrim { display: none; }

/* ---- wide screens: list on the left, the card on the right (sticky, never covers the list) */
@media (min-width: 761px) and (min-height: 561px) {
  .bag { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "top card" "list card"; grid-template-rows: auto 1fr; column-gap: 16px; }
  .bg-top { grid-area: top; margin-right: 0; }
  .bg-list { grid-area: list; padding-bottom: 8px; }
  .bg-card { grid-area: card; position: sticky; top: 12px; align-self: start; margin-top: 12px; max-height: calc(100% - 24px); }
}

/* ---- phones and short landscape: the card is a bottom sheet over a dimmed list */
@media (max-width: 760px), (max-height: 560px) {
  html .modal.bag-panel .modal-body { padding: 0 12px calc(var(--sab, 0px) + 16px); }
  .bg-top { margin: 0 -12px; padding: 10px 12px 8px; }
  .bg-scrim { display: block; position: absolute; inset: 0; z-index: 20; background: rgba(4, 8, 22, .55); opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease); }
  .bag.has-sel .bg-scrim { opacity: 1; pointer-events: auto; }
  .bg-card { position: absolute; z-index: 21; left: 0; right: 0; bottom: 0; margin: 0 auto; width: min(560px, 100%); max-height: 82%; border-radius: 20px 20px 0 0; border-width: 1px 1px 0;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .5); transform: translateY(105%); visibility: hidden; transition: transform 240ms var(--ease), visibility 0s 240ms; }
  .bg-card.open { transform: none; visibility: visible; transition: transform 240ms var(--ease); }
  .bg-grip { display: block; flex: none; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: rgba(255, 255, 255, .22); }
  .bg-head { padding: 8px 8px 8px 14px; flex: none; }
  .bg-x { display: grid; }
  .bg-body { overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(var(--sab, 0px) + 16px); }
  .bg-hint { display: none; }
}
@media (max-width: 760px) {
  /* pockets: one row of eight, icon + count over a short name; no sideways scrolling */
  .bg-pockets { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }   /* All, 6 pockets, Shards */
  .bg-pk { flex-direction: column; justify-content: center; gap: 3px; min-height: 46px; padding: 4px 2px; border-radius: 12px; }
  .bg-pk-top { display: inline-flex; gap: 3px; }
  .bg-pk-top em { order: 1; font-size: 11px; }
  .bg-pk .ic { width: 16px; height: 16px; }
  .bg-pk-l { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 100%; }
  .bg-items { grid-template-columns: 1fr; }
  .bg-row { min-height: 54px; }
}
/* short landscape phones: the pockets and search share one row to leave room for the list */
@media (max-height: 560px) and (min-width: 561px) {
  .bg-top { grid-template-columns: minmax(0, 1fr) minmax(200px, 34%); align-items: center; }
  .bg-pockets { display: flex; flex-wrap: nowrap; gap: 4px; }
  .bg-pk { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 4px; min-height: 40px; gap: 4px; }
  .bg-pk-l { display: none; }
  .bg-pk[data-pocket="all"] .bg-pk-l { display: inline; }
  .bg-pk-top { display: inline-flex; gap: 4px; }
  .bg-pk-top em { order: 1; }
  .bg-list { padding-top: 8px; }
  .bg-card { max-height: 92%; }
}
@media (prefers-reduced-motion: reduce) { .bg-card, .bg-card.open, .bg-scrim { transition: none; } }

/* The pocket row needs ~900px as one line of icon + name + count. In a narrower bag (a 1280px desktop window, tablets)
   the names were cut down to "B.." / "Be..": there each pocket shows its icon and count on top and the name below. */
.bg-top { container-type: inline-size; }
@container (min-width: 500px) and (max-width: 900px) {
  .bg-pk { flex-direction: column; gap: 3px; min-height: 52px; padding: 6px 4px 5px; }
  .bg-pk-top { display: inline-flex; gap: 6px; }
  .bg-pk-l { font-size: 12px; }
}
