/* Inventory Window */
.msx-inv-window {
  position: absolute;
  top: 60px;
  right: 20px;
  width: 250px;
  background: rgba(18, 18, 18, 0.94);
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 140, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 110;
  font-family: 'Kanit', sans-serif;
  color: #fff;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.msx-inv-header {
  background: #1f1f1f;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #333;
  cursor: move;
}

.msx-inv-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffb347;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msx-inv-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 16px;
  cursor: pointer;
}
.msx-inv-close:hover { color: #ff4757; }

.msx-inv-tabs {
  display: flex;
  background: #141414;
  border-bottom: 1px solid #2a2a2a;
}

.msx-inv-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #888;
  font-size: 11px;
  padding: 6px 2px;
  cursor: pointer;
  text-align: center;
}
.msx-inv-tab:hover { color: #fff; }
.msx-inv-tab.active {
  color: #ff8c00;
  border-bottom-color: #ff8c00;
  font-weight: 700;
  background: rgba(255, 140, 0, 0.08);
}

.msx-inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  background: #0d0d0d;
}

.msx-inv-slot {
  width: 52px;
  height: 52px;
  background: #181818;
  border: 1px solid #282828;
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msx-inv-slot:hover {
  border-color: #ff8c00;
  background: #202020;
}

.msx-inv-item-img {
  max-width: 40px;
  max-height: 40px;
  image-rendering: pixelated;
}

.msx-inv-qty {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #ffeb3b;
  text-shadow: 1px 1px 2px #000, -1px -1px 2px #000;
}

.msx-inv-footer {
  background: #141414;
  padding: 6px 10px;
  border-top: 1px solid #2a2a2a;
  display: flex;
  justify-content: flex-end;
}

.msx-inv-meso {
  font-size: 11px;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 5px;
}
.msx-inv-meso-val {
  color: #ffd700;
  font-weight: 700;
}


.msx-inv-window { width: 294px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 100px); }
.msx-inv-header { cursor: default; flex-shrink: 0; }
.msx-inv-grid { min-height: 52px; overflow-y: auto; flex: 1 1 auto; }
.msx-inv-slot { width: 100%; min-height: 44px; padding: 0; cursor: pointer; color: inherit; }
.msx-inv-slot[aria-pressed="true"] { outline: 2px solid #ff8c00; outline-offset: -2px; }
.msx-inv-slot:disabled { cursor: default; }
.msx-inv-modes, .msx-inv-paging { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; flex-shrink: 0; }
.msx-inv-modes button, .msx-inv-paging button, .msx-inv-action { min-height: 32px; border: 1px solid #444; border-radius: 4px; background: #222; color: #fff; cursor: pointer; }
.msx-inv-modes button { flex: 1; }
.msx-inv-paging button:disabled, .msx-inv-action:disabled { opacity: .4; cursor: not-allowed; }
.msx-inv-page { font-size: 10px; white-space: nowrap; }
.msx-inv-footer { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.msx-inv-selection, .msx-inv-status { font-size: 11px; overflow-wrap: anywhere; }
.msx-inv-status { color: #ffcc80; min-height: 14px; }
.msx-inv-icon-missing { font-size: 9px; overflow-wrap: anywhere; }
.msx-inv-meso { font-size: 10px; flex-wrap: wrap; }
@media (max-height: 500px) { .msx-inv-window { top: 12px; max-height: calc(100dvh - 24px); } }
@media (pointer: coarse) { .msx-inv-action, .msx-inv-modes button, .msx-inv-paging button { min-height: 44px; } }
