/* Grid inventory: character panel, storage grids, items, drag ghost, context menu.
   --cell is set from JS (src/ui/inventory.js CELL) so layout math and CSS agree. */

.inv { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.inv-col { display: flex; flex-direction: column; gap: 10px; }
.inv-title { font-size: 18px; color: var(--brass); letter-spacing: 0.04em; }

/* ---------- equipment slots ---------- */
.equip {
  display: grid;
  grid-template-columns: calc(var(--cell) * 3) calc(var(--cell) * 3);
  grid-template-areas:
    "primary primary"
    "sidearm armor"
    "rig     pack";
  gap: 8px;
}
.slot-box {
  position: relative;
  height: calc(var(--cell) * 2);
  border: 1px dashed var(--brass-dim);
  border-radius: 6px;
  background: #0d0907;
}
.s-primary { grid-area: primary; }
.s-sidearm { grid-area: sidearm; }
.s-armor   { grid-area: armor; }
.s-rig     { grid-area: rig; }
.s-pack    { grid-area: pack; }
.slot-label { position: absolute; top: 2px; left: 6px; font-size: 11px; color: var(--dim); pointer-events: none; z-index: 1; }
.slot-box .item { inset: 18px 4px 4px 4px; }
.slot-box.ok { outline: 2px solid var(--go); background: #5ef2a61a; }
.slot-box.bad { outline: 2px solid var(--bad); background: #ff4a3a1a; }

/* ---------- grids ---------- */
.carry { display: flex; flex-direction: column; gap: 8px; }
.grid-label { font: 600 12px var(--font-body); color: var(--dim); margin-bottom: 3px; }
.grid {
  position: relative;
  background-color: #0d0907;
  background-image:
    linear-gradient(#3b2c1f 1px, transparent 1px),
    linear-gradient(90deg, #3b2c1f 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  outline: 1px solid var(--line);
}
.strongbox .grid { outline-color: var(--brass-dim); box-shadow: 0 0 10px #d9a44122; }
.strongbox .grid-label { color: var(--brass); }

.other-scroll { max-height: min(62vh, 640px); overflow: auto; padding: 1px; scrollbar-color: var(--brass-dim) transparent; }
.inv-other .empty { width: calc(var(--cell) * 6); }

.drop-preview { position: absolute; pointer-events: none; z-index: 3; border: 2px solid; border-radius: 3px; }
.drop-preview.ok { border-color: var(--go); background: #5ef2a62e; }
.drop-preview.bad { border-color: var(--bad); background: #ff4a3a2e; }

/* ---------- items ---------- */
.item {
  --rc: var(--r-common);
  position: absolute;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 3px 5px;
  border: 1px solid color-mix(in srgb, var(--rc) 65%, transparent);
  border-radius: 4px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--rc) 22%, transparent), transparent 70%),
    #140e0a;
  color: var(--ink);
  font: 600 11px/1.15 var(--font-body);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 2;
}
.item:hover { border-color: var(--rc); box-shadow: 0 0 8px color-mix(in srgb, var(--rc) 40%, transparent); }
.item.r-uncommon { --rc: var(--r-uncommon); }
.item.r-rare     { --rc: var(--r-rare); }
.item.r-exotic   { --rc: var(--r-exotic); }
/* item art: centered at its unrotated size; rotated items spin it 90° */
.item .icon {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 0;
  filter: drop-shadow(0 2px 2px #000a);
}
.item.rot .icon { transform: translate(-50%, -50%) rotate(90deg); }
.slot-box .item .icon { left: 0; top: 0; width: 100%; height: 100%; padding: 3px 4px 10px; transform: none; }

.slot-sil { position: absolute; inset: 18px 8px 6px; pointer-events: none; opacity: 0.12; filter: grayscale(1) brightness(1.6); }
.slot-sil .icon { width: 100%; height: 100%; }

.thumb {
  flex: none; width: 46px; height: 34px; padding: 2px;
  border: 1px solid var(--line); border-radius: 5px;
  background: radial-gradient(circle at 50% 40%, #2a1f16, #0d0907);
}
.thumb .icon { width: 100%; height: 100%; filter: drop-shadow(0 1px 1px #000a); }
.shop-row { justify-content: flex-start; }
.shop-row .grow { flex: 1; }

.item-nm {
  position: relative; z-index: 1;
  text-shadow: 0 0 3px #000, 0 1px 2px #000;
  font-size: 10.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-badge {
  position: absolute; right: 2px; bottom: 1px; z-index: 1;
  padding: 0 3px; border-radius: 3px; background: #0009;
  font: 700 10.5px var(--font-gauge); color: var(--brass); white-space: nowrap;
}
.item.rot .item-nm { writing-mode: vertical-rl; }
.item.dragging { opacity: 0.25; }
.item.ghost { position: fixed; z-index: 60; pointer-events: none; opacity: 0.9; box-shadow: 0 6px 20px #000a; cursor: grabbing; }

/* ---------- context menu ---------- */
.ctx {
  position: fixed; z-index: 70;
  display: flex; flex-direction: column; min-width: 160px;
  background: var(--pan-2); border: 1px solid var(--brass-dim); border-radius: 6px;
  box-shadow: 0 8px 24px #000c; padding: 4px;
}
.ctx button { min-height: 32px; border: 0; background: none; text-align: left; font-size: 14px; border-radius: 4px; }
.ctx button:hover { background: #d9a44122; }

/* ---------- in-raid overlay ---------- */
.inv-over { background: #000c; align-items: start; overflow: auto; }
.box.inv-box { width: auto; max-width: min(1100px, 100%); }
.inv-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.inv-head h2 { font-size: 28px; margin: 0; }
