.desktop{
  flow: h-flow;
  accept-drop: selector( .desktop [type=button] );
  drop:insert; 
  border-radius:0 0 4px 4px;
  padding:10px !important;
  border:0;
  overflow:auto; 
  active-on!: 
	prev = $(.desktop [type=button][selected] ),
	prev:current = null,
	prev.selected = null, 
	ctrls = self.$1p(html).$(.game-control-button),
	prev ? ( ctrls:disabled = true  )
  ;
}

@set desktop-button{

	:root {
	  behavior:"desktop.item"; 
	  width:86px; //max-intrinsic;
	  height:85px; 
	  //border-radius:4px; 
	  padding: 2px;
	  border: 1px solid;
	  border-color: transparent;
	  foreground-repeat: no-repeat;
	  foreground-position: 95% 2px; 
	  text-align:center; 
	  margin:2px 10px 2px 0px;
	} 

	:root:hover {
	   background-color:transparent; 
	   border-color: #DDD;
	}

	:root[selected]{  
	   background-color:transparent; 
	   border-color: #599CD3;  
	}
	
	:root[data-link-type="repository"][selected]{
		assigned!:
			self.$1p(html).$(.game-control-button):disabled = false,
			self.$1p(html).$(.game-cloud-control-button):disabled = true
		  ;
	}
	:root[data-link-type="repository-cloud"][selected]{
		assigned!:
			self.$1p(html).$(.game-control-button):disabled = false
		  ;
	}
	:root[data-link-type="file"][selected] { 
		assigned!:
			self.$1p(html).$(.game-control-button):disabled = true,
			self.$1p(html).$(.control-button):disabled = false
		;
	} 
	
	:root[data-link-type="url"][selected] { 
		assigned!:
			self.$1p(html).$(.game-control-button):disabled = true,
			self.$1p(html).$(.control-button):disabled = false
		;
	} 

	:root[data-link-type="repository"] { 
		context-menu: selector(menu#repository-context-menu); 
	} 
	
	:root[data-link-type="repository-cloud"] { 
		context-menu: selector(menu#repository-cloud-context-menu); 
	} 

	:root[data-link-type="file"] { 
		context-menu: selector(menu#file-context-menu); 
	} 

	:root[data-link-type="url"] { 
		context-menu: selector(menu#url-context-menu); 
	} 
	
	:root[game-status="loading"] { 
		foreground-image: url(images/loading.gif); 
	} 

	:root[game-updated]:not( [game-status] ) { 
	  foreground-image: url(images/update.png); 
	} 

	:root span{   
	  
	  margin-left:3px;
	  padding:1px; 
	  display:block;
	  width:76px;
	  
	  overflow:hidden;
	  white-space:nowrap;
	  text-overflow:ellipsis;
	}

	:root[selected] span{  
	  
	  text-align:center;
	  color:#000000;  
	}

	:root[selected] span[editable]{  
	  behavior:edit;
	  background:url(theme:edit-normal) expand; 
	  text-align:center;
	  color:#000; 
	  padding:3px; 
	  assigned!:self:focus=true,self.selectAll(true);  
	}


	:root  [icon]{
	  margin:6px 50%% 6px 50%%;
	  width:48px;
	  height:48px;
	  
	  border:0 solid red;
	  //border-radius:9px;  
	  
	  background-repeat: stretch; //no-repeat;
	  background-position: 0 0;     
	}

	:root [filename]{
	  margin:6px 50%% 6px 50%%;
	  width:48px;
	  height:48px;
	  border:0 solid red;
	  
	  background-repeat: no-repeat;
	  background-position: 0 0; 
	}
	 
	:root [icon]:hover{
	  background-image-transformation: contrast-brightness-gamma(0.7,0.6,0.9); 
	}

	:root [icon]:active {
	  background-image-transformation: contrast-brightness-gamma(0.6,0.4,1.5);
	  margin:5px 50%% 7px 50%%;
	} 

	:root popup {
	  text-align:left;
	}

	:root popup dl{
	  margin: 9px 5px;
	}

	:root popup dl dt{　
	  margin-bottom: 12px;
	  font-weight: bold;
	}

	:root popup dl dd{
	  padding-left: 8px;
	}
} 

.desktop div[type=button]{
	style-set:desktop-button;
}

menu#repository-context-menu,menu#repository-cloud-context-menu,menu#file-context-menu,menu#url-context-menu{
  behavior:~ url(desktop.contextMenu);
}

.desktop[dragable] div[type=button]{
  draggable:only-move;
} 
